Java XML Attribute Print printAttributesCompact(NamedNodeMap attributes, String indent, boolean descend)

Here you can find the source of printAttributesCompact(NamedNodeMap attributes, String indent, boolean descend)

Description

print Attributes Compact

License

Open Source License

Declaration

private static void printAttributesCompact(NamedNodeMap attributes, String indent, boolean descend) 

Method Source Code

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

import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;

public class Main {
    private static void printAttributesCompact(NamedNodeMap attributes, String indent, boolean descend) {

        System.out.println(indent + "Attributes: " + getAttributesCompact(attributes));
    }//w ww  . j  av a2s . c  o  m

    private static String getAttributesCompact(NamedNodeMap attributes) {

        String s = "[";
        for (int i = 0; i < attributes.getLength(); ++i) {
            Node n = attributes.item(i);
            s += n.getNodeName() + "=\"" + n.getNodeValue() + "\"";
            s += ", ";
        }
        s += "]";

        return s;
    }
}

Related

  1. printAttribute(String nombre, NodeList nodes)
  2. printAttribute(XMLStreamReader xmlr, int index, StringBuffer result)
  3. printAttributes(Element element)
  4. printAttributes(NamedNodeMap attributes, String indent, boolean descend)
  5. printAttributes(XMLStreamReader xmlr)
  6. printAttrs(Element elem, String endient, PrintStream pstrm)
  7. printImageAttributeType(Integer value)