Java Utililty Methods XML Attribute Print

List of utility methods to do XML Attribute Print

Description

The list of methods to do XML Attribute Print are organized into topic(s).

Method

voidprintAttribute(Node node, int level)
Prints attribute variables of the specified node.
for (int i = 0; i < level; i++) {
    System.out.print("  ");
System.out.println("<" + node.getNodeName() + " = " + node.getNodeValue() + ">");
ListprintAttribute(String nombre, NodeList nodes)
print Attribute
List<String> nodeText = new ArrayList<String>();
for (int i = 0; i < nodes.getLength(); i++) {
    Node node = (Node) nodes.item(i);
    nodeText.add(normalizeName(giveAttributeNode(nombre, node)));
return nodeText;
ListprintAttribute(String nombre, NodeList nodes)
Este metodo convierte un objeto de tipo org.w3c.dom.NodeList a List Este metodo solo saca el atributo especificado con nombre
List<String> nodeText = new ArrayList<String>();
for (int i = 0; i < nodes.getLength(); i++) {
    Node node = (Node) nodes.item(i);
    nodeText.add(normalizeName(giveAttributeNode(nombre, node)));
return nodeText;
voidprintAttribute(XMLStreamReader xmlr, int index, StringBuffer result)
print Attribute
String prefix = xmlr.getAttributePrefix(index);
String namespace = xmlr.getAttributeNamespace(index);
String localName = xmlr.getAttributeLocalName(index);
String value = xmlr.getAttributeValue(index);
result.append(" ");
printName(prefix, namespace, localName, result);
result.append("='").append(value).append("'");
voidprintAttributes(Element element)
print Attributes
NamedNodeMap attributes = element.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
    Node node = attributes.item(i);
    System.err.println("## prefix=" + node.getPrefix() + " localname:" + node.getLocalName() + " value="
            + node.getNodeValue());
voidprintAttributes(NamedNodeMap attributes, String indent, boolean descend)
print Attributes
System.out.println();
for (int i = 0; i < attributes.getLength(); ++i) {
    System.out.println(indent + "-- Attribute: " + i + " -----");
    printToTerminal(attributes.item(i), indent + "  ", descend);
System.out.println(indent + "-- ^last attribute --\n");
voidprintAttributes(XMLStreamReader xmlr)
Print out element attributes
if (xmlr.getAttributeCount() > 0) {
    System.out.println("\nHAS ATTRIBUTES: ");
    int count = xmlr.getAttributeCount();
    for (int i = 0; i < count; i++) {
        QName name = xmlr.getAttributeName(i);
        String namespace = xmlr.getAttributeNamespace(i);
        String type = xmlr.getAttributeType(i);
        String prefix = xmlr.getAttributePrefix(i);
...
voidprintAttributesCompact(NamedNodeMap attributes, String indent, boolean descend)
print Attributes Compact
System.out.println(indent + "Attributes: " + getAttributesCompact(attributes));
voidprintAttrs(Element elem, String endient, PrintStream pstrm)
print Attrs
NamedNodeMap attrs = elem.getAttributes();
if (attrs.getLength() == 0) {
    pstrm.print(">");
    return;
Attr attr = (Attr) attrs.item(0);
if (attrs.getLength() == 1) {
    pstrm.print(" " + attr.getName() + "=\"" + attr.getValue() + "\">");
...
StringprintImageAttributeType(Integer value)
print Image Attribute Type
if (value == null || !isValidImageAttributeType(value))
    throw new IllegalArgumentException("Can't print image-attribute value!");
else
    return DatatypeConverter.printInt(value);