Java XML QName parseXml(final Node node, final Map properties)

Here you can find the source of parseXml(final Node node, final Map properties)

Description

parse Xml

License

Open Source License

Declaration

private static Map<QName, String> parseXml(final Node node, final Map<QName, String> properties) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Map;

import javax.xml.namespace.QName;

import org.w3c.dom.Node;

public class Main {
    private static Map<QName, String> parseXml(final Node node, final Map<QName, String> properties) {
        for (int i = 0; i < node.getAttributes().getLength(); i++) {
            final Node item = node.getAttributes().item(i);
            final QName itemType = (item.getNamespaceURI() == null) ? new QName(item.getNodeName())
                    : new QName(item.getNamespaceURI(), item.getLocalName());
            properties.put(itemType, item.getNodeValue());
        }/* w w  w. j a  va  2s .c om*/
        for (int i = 0; i < node.getChildNodes().getLength(); i++) {
            final Node item = node.getChildNodes().item(i);
            final QName itemType = (item.getNamespaceURI() == null) ? new QName(item.getNodeName())
                    : new QName(item.getNamespaceURI(), item.getLocalName());
            properties.put(itemType, item.getNodeValue());
        }
        return properties;
    }
}

Related

  1. matchingNamespace(Node node, QName requiredNamespace)
  2. matchNode(Node node, QName name)
  3. moveReaderToTag(XMLStreamReader reader, QName... tags)
  4. namedNode(QName qname)
  5. nodeToQName(Node node)
  6. printPath(List path)
  7. read(Node node, String expression, QName returnType)
  8. readTextElement(XMLEventReader reader, QName elemName)
  9. resolveNamespace(String qname, Node xml)