Code example for Node

Methods: getAttributes, getNodeName

0
    public Map<String, String> getMetadataFromXML(String xmlSource) throws SerializerException {
        return getMetadata(xmlSource);
    } 
 
    private void renameAttrToTag(Document document, Node node) throws DOMException {
        if (node.getNodeName().equals("attr")) {
            String tag = node.getAttributes().getNamedItem("tag").getNodeValue();
 
            if (!tag.equals("?")) {
                document.renameNode(node, null, "tag" + tag);
            } 
        } 
    } 
     
    private void renameTagToAttr(Document document, Node node) throws DOMException {
        NamedNodeMap attr = node.getAttributes();
 
        if (attr != null) {
            Node tagAttr = attr.getNamedItem("tag");
 
            if (tagAttr != null) {