Example usage for org.w3c.dom TypeInfo getTypeNamespace

List of usage examples for org.w3c.dom TypeInfo getTypeNamespace

Introduction

In this page you can find the example usage for org.w3c.dom TypeInfo getTypeNamespace.

Prototype

public String getTypeNamespace();

Source Link

Document

The namespace of the type declared for the associated element or attribute or null if the element does not have declaration or if no namespace information is available.

Usage

From source file:TypeInfoWriter.java

/** Start element. */
public void startElement(String uri, String localName, String qname, Attributes attributes)
        throws SAXException {

    TypeInfo type;
    printIndent();/*from w w  w  .ja  va  2s  . co  m*/
    fOut.print("startElement(");
    fOut.print("name=");
    printQName(uri, localName);
    fOut.print(',');
    fOut.print("type=");
    if (fTypeInfoProvider != null && (type = fTypeInfoProvider.getElementTypeInfo()) != null) {
        printQName(type.getTypeNamespace(), type.getTypeName());
    } else {
        fOut.print("null");
    }
    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) {
                fOut.print(',');
            }
            String attrURI = attributes.getURI(i);
            String attrLocalName = attributes.getLocalName(i);
            fOut.print('{');
            fOut.print("name=");
            printQName(attrURI, attrLocalName);
            fOut.print(',');
            fOut.print("type=");
            if (fTypeInfoProvider != null && (type = fTypeInfoProvider.getAttributeTypeInfo(i)) != null) {
                printQName(type.getTypeNamespace(), type.getTypeName());
            } else {
                fOut.print("null");
            }
            fOut.print(',');
            fOut.print("id=");
            fOut.print(
                    fTypeInfoProvider != null && fTypeInfoProvider.isIdAttribute(i) ? "\"true\"" : "\"false\"");
            fOut.print(',');
            fOut.print("specified=");
            fOut.print(
                    fTypeInfoProvider == null || fTypeInfoProvider.isSpecified(i) ? "\"true\"" : "\"false\"");
            fOut.print('}');
        }
        fOut.print('}');
    }
    fOut.println(')');
    fOut.flush();
    fIndent++;

}