http://www.atmarkit.co.jp/fxml/ddd/ddd001/ddd001-namespaces1.html XMLを返すurlからXMLデータを取得、解析し、Nodeのリストを作成する。 URLConnection conn = (new URL(url)).openConnection(); conn.connect(); InputSource in = new InputSource(new InputStreamReader(conn.getInputStream())); XPathFactory xfactory = XPathFactory.newInstance(); XPath xpath = xfactory.newXPath(); NodeList result = (NodeList)xpath.evaluate("//*[local-name()='Parameter']/text()", in, XPathConstants.NODESET); for (int i=0; i map = new HashMap(); public NameSpaceContextImpl() { setNamespaceURI(XMLConstants.DEFAULT_NS_PREFIX, XMLConstants.NULL_NS_URI); setNamespaceURI(XMLConstants.XML_NS_PREFIX, XMLConstants.XML_NS_URI); setNamespaceURI(XMLConstants.XMLNS_ATTRIBUTE, XMLConstants.XMLNS_ATTRIBUTE_NS_URI); } public void setNamespaceURI(String prefix, String uri) { map.put(prefix, uri); } public String getNamespaceURI(String prefix) { return map.get(prefix); } public String getPrefix(String namespaceURI) { if (namespaceURI == null) { throw new IllegalArgumentException(); } Set>set = map.entrySet(); for (Map.Entryitem : set) { if (namespaceURI.equals(item.getValue())) { return item.getKey(); } } return XMLConstants.NULL_NS_URI; } public Iterator getPrefixes(String namespaceURI) { Set prefixes = new HashSet(); Set>set = map.entrySet(); for (Map.Entryitem : set) { if (namespaceURI.equals(item.getValue())) { prefixes.add(item.getKey()); } } return Collections.unmodifiableCollection(prefixes).iterator(); } }