Example usage for org.xml.sax AttributeList getType

List of usage examples for org.xml.sax AttributeList getType

Introduction

In this page you can find the example usage for org.xml.sax AttributeList getType.

Prototype

public abstract String getType(String name);

Source Link

Document

Return the type of an attribute in the list (by name).

Usage

From source file:DocumentTracer.java

/** Start element. */
public void startElement(String name, AttributeList attributes) throws SAXException {

    printIndent();//from   w  w  w.j a  va 2 s. c  o  m
    fOut.print("startElement(");
    fOut.print("name=");
    printQuotedString(name);
    fOut.print(',');
    fOut.print("attributes=");
    if (attributes == null) {
        fOut.println("null");
    } else {
        fOut.print('{');
        int length = attributes.getLength();
        for (int i = 0; i < length; i++) {
            if (i > 0) {
                System.out.print(',');
            }
            String attrName = attributes.getName(i);
            String attrType = attributes.getType(i);
            String attrValue = attributes.getValue(i);
            fOut.print('{');
            fOut.print("name=");
            printQuotedString(attrName);
            fOut.print(',');
            fOut.print("type=");
            printQuotedString(attrType);
            fOut.print(',');
            fOut.print("value=");
            printQuotedString(attrValue);
            fOut.print('}');
        }
        fOut.print('}');
    }
    fOut.println(')');
    fOut.flush();
    fIndent++;

}