Java Code Examples for com.sun.org.apache.xerces.internal.xni.NamespaceContext#getAllPrefixes()

The following examples show how to use com.sun.org.apache.xerces.internal.xni.NamespaceContext#getAllPrefixes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NamespaceSupport.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a namespace context object and initializes it with
 * the prefixes declared in the specified context.
 */
public NamespaceSupport(NamespaceContext context) {
    pushContext();
    // copy declaration in the context
    Enumeration prefixes = context.getAllPrefixes();
    while (prefixes.hasMoreElements()){
        String prefix = (String)prefixes.nextElement();
        String uri = context.getURI(prefix);
        declarePrefix(prefix, uri);
    }
}
 
Example 2
Source File: NamespaceSupport.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a namespace context object and initializes it with
 * the prefixes declared in the specified context.
 */
public NamespaceSupport(NamespaceContext context) {
    pushContext();
    // copy declaration in the context
    Enumeration prefixes = context.getAllPrefixes();
    while (prefixes.hasMoreElements()){
        String prefix = (String)prefixes.nextElement();
        String uri = context.getURI(prefix);
        declarePrefix(prefix, uri);
    }
}
 
Example 3
Source File: NamespaceSupport.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a namespace context object and initializes it with
 * the prefixes declared in the specified context.
 */
public NamespaceSupport(NamespaceContext context) {
    pushContext();
    // copy declaration in the context
    Enumeration prefixes = context.getAllPrefixes();
    while (prefixes.hasMoreElements()){
        String prefix = (String)prefixes.nextElement();
        String uri = context.getURI(prefix);
        declarePrefix(prefix, uri);
    }
}
 
Example 4
Source File: NamespaceSupport.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a namespace context object and initializes it with
 * the prefixes declared in the specified context.
 */
public NamespaceSupport(NamespaceContext context) {
    pushContext();
    // copy declaration in the context
    Enumeration prefixes = context.getAllPrefixes();
    while (prefixes.hasMoreElements()){
        String prefix = (String)prefixes.nextElement();
        String uri = context.getURI(prefix);
        declarePrefix(prefix, uri);
    }
}
 
Example 5
Source File: NamespaceSupport.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Constructs a namespace context object and initializes it with
 * the prefixes declared in the specified context.
 */
public NamespaceSupport(NamespaceContext context) {
    pushContext();
    // copy declaration in the context
    Enumeration prefixes = context.getAllPrefixes();
    while (prefixes.hasMoreElements()){
        String prefix = (String)prefixes.nextElement();
        String uri = context.getURI(prefix);
        declarePrefix(prefix, uri);
    }
}
 
Example 6
Source File: NamespaceSupport.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a namespace context object and initializes it with
 * the prefixes declared in the specified context.
 */
public NamespaceSupport(NamespaceContext context) {
    pushContext();
    // copy declaration in the context
    Enumeration prefixes = context.getAllPrefixes();
    while (prefixes.hasMoreElements()){
        String prefix = (String)prefixes.nextElement();
        String uri = context.getURI(prefix);
        declarePrefix(prefix, uri);
    }
}
 
Example 7
Source File: NamespaceSupport.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a namespace context object and initializes it with
 * the prefixes declared in the specified context.
 */
public NamespaceSupport(NamespaceContext context) {
    pushContext();
    // copy declaration in the context
    Enumeration prefixes = context.getAllPrefixes();
    while (prefixes.hasMoreElements()){
        String prefix = (String)prefixes.nextElement();
        String uri = context.getURI(prefix);
        declarePrefix(prefix, uri);
    }
}
 
Example 8
Source File: NamespaceSupport.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a namespace context object and initializes it with
 * the prefixes declared in the specified context.
 */
public NamespaceSupport(NamespaceContext context) {
    pushContext();
    // copy declaration in the context
    Enumeration prefixes = context.getAllPrefixes();
    while (prefixes.hasMoreElements()){
        String prefix = (String)prefixes.nextElement();
        String uri = context.getURI(prefix);
        declarePrefix(prefix, uri);
    }
}
 
Example 9
Source File: NamespaceSupport.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a namespace context object and initializes it with
 * the prefixes declared in the specified context.
 */
public NamespaceSupport(NamespaceContext context) {
    pushContext();
    // copy declaration in the context
    Enumeration prefixes = context.getAllPrefixes();
    while (prefixes.hasMoreElements()){
        String prefix = (String)prefixes.nextElement();
        String uri = context.getURI(prefix);
        declarePrefix(prefix, uri);
    }
}
 
Example 10
Source File: NamespaceSupport.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs a namespace context object and initializes it with
 * the prefixes declared in the specified context.
 */
public NamespaceSupport(NamespaceContext context) {
    pushContext();
    // copy declaration in the context
    Enumeration<String> prefixes = context.getAllPrefixes();
    while (prefixes.hasMoreElements()){
        String prefix = prefixes.nextElement();
        String uri = context.getURI(prefix);
        declarePrefix(prefix, uri);
    }
}
 
Example 11
Source File: NamespaceSupport.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a namespace context object and initializes it with
 * the prefixes declared in the specified context.
 */
public NamespaceSupport(NamespaceContext context) {
    pushContext();
    // copy declaration in the context
    Enumeration prefixes = context.getAllPrefixes();
    while (prefixes.hasMoreElements()){
        String prefix = (String)prefixes.nextElement();
        String uri = context.getURI(prefix);
        declarePrefix(prefix, uri);
    }
}
 
Example 12
Source File: SchemaDOM.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
void startAnnotation(String elemRawName, XMLAttributes attributes,
        NamespaceContext namespaceContext) {
    if(fAnnotationBuffer == null) fAnnotationBuffer = new StringBuffer(256);
    fAnnotationBuffer.append("<").append(elemRawName).append(" ");

    // attributes are a bit of a pain.  To get this right, we have to keep track
    // of the namespaces we've seen declared, then examine the namespace context
    // for other namespaces so that we can also include them.
    // optimized for simplicity and the case that not many
    // namespaces are declared on this annotation...
    ArrayList namespaces = new ArrayList();
    for (int i = 0; i < attributes.getLength(); ++i) {
        String aValue = attributes.getValue(i);
        String aPrefix = attributes.getPrefix(i);
        String aQName = attributes.getQName(i);
        // if it's xmlns:* or xmlns, must be a namespace decl
        if (aPrefix == XMLSymbols.PREFIX_XMLNS || aQName == XMLSymbols.PREFIX_XMLNS) {
            namespaces.add(aPrefix == XMLSymbols.PREFIX_XMLNS ?
                    attributes.getLocalName(i) : XMLSymbols.EMPTY_STRING);
        }
        fAnnotationBuffer.append(aQName).append("=\"").append(processAttValue(aValue)).append("\" ");
    }
    // now we have to look through currently in-scope namespaces to see what
    // wasn't declared here
    Enumeration currPrefixes = namespaceContext.getAllPrefixes();
    while(currPrefixes.hasMoreElements()) {
        String prefix = (String)currPrefixes.nextElement();
        String uri = namespaceContext.getURI(prefix);
        if (uri == null) {
            uri = XMLSymbols.EMPTY_STRING;
        }
        if (!namespaces.contains(prefix)) {
            // have to declare this one
            if(prefix == XMLSymbols.EMPTY_STRING) {
                fAnnotationBuffer.append("xmlns").append("=\"").append(processAttValue(uri)).append("\" ");
            }
            else {
                fAnnotationBuffer.append("xmlns:").append(prefix).append("=\"").append(processAttValue(uri)).append("\" ");
            }
        }
    }
    fAnnotationBuffer.append(">\n");
}
 
Example 13
Source File: SchemaDOM.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
void startAnnotation(String elemRawName, XMLAttributes attributes,
        NamespaceContext namespaceContext) {
    if(fAnnotationBuffer == null) fAnnotationBuffer = new StringBuffer(256);
    fAnnotationBuffer.append("<").append(elemRawName).append(" ");

    // attributes are a bit of a pain.  To get this right, we have to keep track
    // of the namespaces we've seen declared, then examine the namespace context
    // for other namespaces so that we can also include them.
    // optimized for simplicity and the case that not many
    // namespaces are declared on this annotation...
    ArrayList namespaces = new ArrayList();
    for (int i = 0; i < attributes.getLength(); ++i) {
        String aValue = attributes.getValue(i);
        String aPrefix = attributes.getPrefix(i);
        String aQName = attributes.getQName(i);
        // if it's xmlns:* or xmlns, must be a namespace decl
        if (aPrefix == XMLSymbols.PREFIX_XMLNS || aQName == XMLSymbols.PREFIX_XMLNS) {
            namespaces.add(aPrefix == XMLSymbols.PREFIX_XMLNS ?
                    attributes.getLocalName(i) : XMLSymbols.EMPTY_STRING);
        }
        fAnnotationBuffer.append(aQName).append("=\"").append(processAttValue(aValue)).append("\" ");
    }
    // now we have to look through currently in-scope namespaces to see what
    // wasn't declared here
    Enumeration currPrefixes = namespaceContext.getAllPrefixes();
    while(currPrefixes.hasMoreElements()) {
        String prefix = (String)currPrefixes.nextElement();
        String uri = namespaceContext.getURI(prefix);
        if (uri == null) {
            uri = XMLSymbols.EMPTY_STRING;
        }
        if (!namespaces.contains(prefix)) {
            // have to declare this one
            if(prefix == XMLSymbols.EMPTY_STRING) {
                fAnnotationBuffer.append("xmlns").append("=\"").append(processAttValue(uri)).append("\" ");
            }
            else {
                fAnnotationBuffer.append("xmlns:").append(prefix).append("=\"").append(processAttValue(uri)).append("\" ");
            }
        }
    }
    fAnnotationBuffer.append(">\n");
}
 
Example 14
Source File: SchemaDOM.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
void startAnnotation(String elemRawName, XMLAttributes attributes,
        NamespaceContext namespaceContext) {
    if(fAnnotationBuffer == null) fAnnotationBuffer = new StringBuffer(256);
    fAnnotationBuffer.append("<").append(elemRawName).append(" ");

    // attributes are a bit of a pain.  To get this right, we have to keep track
    // of the namespaces we've seen declared, then examine the namespace context
    // for other namespaces so that we can also include them.
    // optimized for simplicity and the case that not many
    // namespaces are declared on this annotation...
    ArrayList namespaces = new ArrayList();
    for (int i = 0; i < attributes.getLength(); ++i) {
        String aValue = attributes.getValue(i);
        String aPrefix = attributes.getPrefix(i);
        String aQName = attributes.getQName(i);
        // if it's xmlns:* or xmlns, must be a namespace decl
        if (aPrefix == XMLSymbols.PREFIX_XMLNS || aQName == XMLSymbols.PREFIX_XMLNS) {
            namespaces.add(aPrefix == XMLSymbols.PREFIX_XMLNS ?
                    attributes.getLocalName(i) : XMLSymbols.EMPTY_STRING);
        }
        fAnnotationBuffer.append(aQName).append("=\"").append(processAttValue(aValue)).append("\" ");
    }
    // now we have to look through currently in-scope namespaces to see what
    // wasn't declared here
    Enumeration currPrefixes = namespaceContext.getAllPrefixes();
    while(currPrefixes.hasMoreElements()) {
        String prefix = (String)currPrefixes.nextElement();
        String uri = namespaceContext.getURI(prefix);
        if (uri == null) {
            uri = XMLSymbols.EMPTY_STRING;
        }
        if (!namespaces.contains(prefix)) {
            // have to declare this one
            if(prefix == XMLSymbols.EMPTY_STRING) {
                fAnnotationBuffer.append("xmlns").append("=\"").append(processAttValue(uri)).append("\" ");
            }
            else {
                fAnnotationBuffer.append("xmlns:").append(prefix).append("=\"").append(processAttValue(uri)).append("\" ");
            }
        }
    }
    fAnnotationBuffer.append(">\n");
}
 
Example 15
Source File: SchemaDOM.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
void startAnnotation(String elemRawName, XMLAttributes attributes,
        NamespaceContext namespaceContext) {
    if(fAnnotationBuffer == null) fAnnotationBuffer = new StringBuffer(256);
    fAnnotationBuffer.append("<").append(elemRawName).append(" ");

    // attributes are a bit of a pain.  To get this right, we have to keep track
    // of the namespaces we've seen declared, then examine the namespace context
    // for other namespaces so that we can also include them.
    // optimized for simplicity and the case that not many
    // namespaces are declared on this annotation...
    ArrayList namespaces = new ArrayList();
    for (int i = 0; i < attributes.getLength(); ++i) {
        String aValue = attributes.getValue(i);
        String aPrefix = attributes.getPrefix(i);
        String aQName = attributes.getQName(i);
        // if it's xmlns:* or xmlns, must be a namespace decl
        if (aPrefix == XMLSymbols.PREFIX_XMLNS || aQName == XMLSymbols.PREFIX_XMLNS) {
            namespaces.add(aPrefix == XMLSymbols.PREFIX_XMLNS ?
                    attributes.getLocalName(i) : XMLSymbols.EMPTY_STRING);
        }
        fAnnotationBuffer.append(aQName).append("=\"").append(processAttValue(aValue)).append("\" ");
    }
    // now we have to look through currently in-scope namespaces to see what
    // wasn't declared here
    Enumeration currPrefixes = namespaceContext.getAllPrefixes();
    while(currPrefixes.hasMoreElements()) {
        String prefix = (String)currPrefixes.nextElement();
        String uri = namespaceContext.getURI(prefix);
        if (uri == null) {
            uri = XMLSymbols.EMPTY_STRING;
        }
        if (!namespaces.contains(prefix)) {
            // have to declare this one
            if(prefix == XMLSymbols.EMPTY_STRING) {
                fAnnotationBuffer.append("xmlns").append("=\"").append(processAttValue(uri)).append("\" ");
            }
            else {
                fAnnotationBuffer.append("xmlns:").append(prefix).append("=\"").append(processAttValue(uri)).append("\" ");
            }
        }
    }
    fAnnotationBuffer.append(">\n");
}
 
Example 16
Source File: SchemaDOM.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
void startAnnotation(String elemRawName, XMLAttributes attributes,
        NamespaceContext namespaceContext) {
    if(fAnnotationBuffer == null) fAnnotationBuffer = new StringBuffer(256);
    fAnnotationBuffer.append("<").append(elemRawName).append(" ");

    // attributes are a bit of a pain.  To get this right, we have to keep track
    // of the namespaces we've seen declared, then examine the namespace context
    // for other namespaces so that we can also include them.
    // optimized for simplicity and the case that not many
    // namespaces are declared on this annotation...
    ArrayList namespaces = new ArrayList();
    for (int i = 0; i < attributes.getLength(); ++i) {
        String aValue = attributes.getValue(i);
        String aPrefix = attributes.getPrefix(i);
        String aQName = attributes.getQName(i);
        // if it's xmlns:* or xmlns, must be a namespace decl
        if (aPrefix == XMLSymbols.PREFIX_XMLNS || aQName == XMLSymbols.PREFIX_XMLNS) {
            namespaces.add(aPrefix == XMLSymbols.PREFIX_XMLNS ?
                    attributes.getLocalName(i) : XMLSymbols.EMPTY_STRING);
        }
        fAnnotationBuffer.append(aQName).append("=\"").append(processAttValue(aValue)).append("\" ");
    }
    // now we have to look through currently in-scope namespaces to see what
    // wasn't declared here
    Enumeration currPrefixes = namespaceContext.getAllPrefixes();
    while(currPrefixes.hasMoreElements()) {
        String prefix = (String)currPrefixes.nextElement();
        String uri = namespaceContext.getURI(prefix);
        if (uri == null) {
            uri = XMLSymbols.EMPTY_STRING;
        }
        if (!namespaces.contains(prefix)) {
            // have to declare this one
            if(prefix == XMLSymbols.EMPTY_STRING) {
                fAnnotationBuffer.append("xmlns").append("=\"").append(processAttValue(uri)).append("\" ");
            }
            else {
                fAnnotationBuffer.append("xmlns:").append(prefix).append("=\"").append(processAttValue(uri)).append("\" ");
            }
        }
    }
    fAnnotationBuffer.append(">\n");
}
 
Example 17
Source File: SchemaDOM.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
void startAnnotation(String elemRawName, XMLAttributes attributes,
        NamespaceContext namespaceContext) {
    if(fAnnotationBuffer == null) fAnnotationBuffer = new StringBuffer(256);
    fAnnotationBuffer.append("<").append(elemRawName).append(" ");

    // attributes are a bit of a pain.  To get this right, we have to keep track
    // of the namespaces we've seen declared, then examine the namespace context
    // for other namespaces so that we can also include them.
    // optimized for simplicity and the case that not many
    // namespaces are declared on this annotation...
    ArrayList namespaces = new ArrayList();
    for (int i = 0; i < attributes.getLength(); ++i) {
        String aValue = attributes.getValue(i);
        String aPrefix = attributes.getPrefix(i);
        String aQName = attributes.getQName(i);
        // if it's xmlns:* or xmlns, must be a namespace decl
        if (aPrefix == XMLSymbols.PREFIX_XMLNS || aQName == XMLSymbols.PREFIX_XMLNS) {
            namespaces.add(aPrefix == XMLSymbols.PREFIX_XMLNS ?
                    attributes.getLocalName(i) : XMLSymbols.EMPTY_STRING);
        }
        fAnnotationBuffer.append(aQName).append("=\"").append(processAttValue(aValue)).append("\" ");
    }
    // now we have to look through currently in-scope namespaces to see what
    // wasn't declared here
    Enumeration currPrefixes = namespaceContext.getAllPrefixes();
    while(currPrefixes.hasMoreElements()) {
        String prefix = (String)currPrefixes.nextElement();
        String uri = namespaceContext.getURI(prefix);
        if (uri == null) {
            uri = XMLSymbols.EMPTY_STRING;
        }
        if (!namespaces.contains(prefix)) {
            // have to declare this one
            if(prefix == XMLSymbols.EMPTY_STRING) {
                fAnnotationBuffer.append("xmlns").append("=\"").append(processAttValue(uri)).append("\" ");
            }
            else {
                fAnnotationBuffer.append("xmlns:").append(prefix).append("=\"").append(processAttValue(uri)).append("\" ");
            }
        }
    }
    fAnnotationBuffer.append(">\n");
}
 
Example 18
Source File: SchemaDOM.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
void startAnnotation(String elemRawName, XMLAttributes attributes,
        NamespaceContext namespaceContext) {
    if(fAnnotationBuffer == null) fAnnotationBuffer = new StringBuffer(256);
    fAnnotationBuffer.append("<").append(elemRawName).append(" ");

    // attributes are a bit of a pain.  To get this right, we have to keep track
    // of the namespaces we've seen declared, then examine the namespace context
    // for other namespaces so that we can also include them.
    // optimized for simplicity and the case that not many
    // namespaces are declared on this annotation...
    ArrayList namespaces = new ArrayList();
    for (int i = 0; i < attributes.getLength(); ++i) {
        String aValue = attributes.getValue(i);
        String aPrefix = attributes.getPrefix(i);
        String aQName = attributes.getQName(i);
        // if it's xmlns:* or xmlns, must be a namespace decl
        if (aPrefix == XMLSymbols.PREFIX_XMLNS || aQName == XMLSymbols.PREFIX_XMLNS) {
            namespaces.add(aPrefix == XMLSymbols.PREFIX_XMLNS ?
                    attributes.getLocalName(i) : XMLSymbols.EMPTY_STRING);
        }
        fAnnotationBuffer.append(aQName).append("=\"").append(processAttValue(aValue)).append("\" ");
    }
    // now we have to look through currently in-scope namespaces to see what
    // wasn't declared here
    Enumeration currPrefixes = namespaceContext.getAllPrefixes();
    while(currPrefixes.hasMoreElements()) {
        String prefix = (String)currPrefixes.nextElement();
        String uri = namespaceContext.getURI(prefix);
        if (uri == null) {
            uri = XMLSymbols.EMPTY_STRING;
        }
        if (!namespaces.contains(prefix)) {
            // have to declare this one
            if(prefix == XMLSymbols.EMPTY_STRING) {
                fAnnotationBuffer.append("xmlns").append("=\"").append(processAttValue(uri)).append("\" ");
            }
            else {
                fAnnotationBuffer.append("xmlns:").append(prefix).append("=\"").append(processAttValue(uri)).append("\" ");
            }
        }
    }
    fAnnotationBuffer.append(">\n");
}
 
Example 19
Source File: SchemaDOM.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
void startAnnotation(String elemRawName, XMLAttributes attributes,
        NamespaceContext namespaceContext) {
    if(fAnnotationBuffer == null) fAnnotationBuffer = new StringBuffer(256);
    fAnnotationBuffer.append("<").append(elemRawName).append(" ");

    // attributes are a bit of a pain.  To get this right, we have to keep track
    // of the namespaces we've seen declared, then examine the namespace context
    // for other namespaces so that we can also include them.
    // optimized for simplicity and the case that not many
    // namespaces are declared on this annotation...
    ArrayList namespaces = new ArrayList();
    for (int i = 0; i < attributes.getLength(); ++i) {
        String aValue = attributes.getValue(i);
        String aPrefix = attributes.getPrefix(i);
        String aQName = attributes.getQName(i);
        // if it's xmlns:* or xmlns, must be a namespace decl
        if (aPrefix == XMLSymbols.PREFIX_XMLNS || aQName == XMLSymbols.PREFIX_XMLNS) {
            namespaces.add(aPrefix == XMLSymbols.PREFIX_XMLNS ?
                    attributes.getLocalName(i) : XMLSymbols.EMPTY_STRING);
        }
        fAnnotationBuffer.append(aQName).append("=\"").append(processAttValue(aValue)).append("\" ");
    }
    // now we have to look through currently in-scope namespaces to see what
    // wasn't declared here
    Enumeration currPrefixes = namespaceContext.getAllPrefixes();
    while(currPrefixes.hasMoreElements()) {
        String prefix = (String)currPrefixes.nextElement();
        String uri = namespaceContext.getURI(prefix);
        if (uri == null) {
            uri = XMLSymbols.EMPTY_STRING;
        }
        if (!namespaces.contains(prefix)) {
            // have to declare this one
            if(prefix == XMLSymbols.EMPTY_STRING) {
                fAnnotationBuffer.append("xmlns").append("=\"").append(processAttValue(uri)).append("\" ");
            }
            else {
                fAnnotationBuffer.append("xmlns:").append(prefix).append("=\"").append(processAttValue(uri)).append("\" ");
            }
        }
    }
    fAnnotationBuffer.append(">\n");
}
 
Example 20
Source File: SchemaDOM.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
void startAnnotation(String elemRawName, XMLAttributes attributes,
        NamespaceContext namespaceContext) {
    if(fAnnotationBuffer == null) fAnnotationBuffer = new StringBuffer(256);
    fAnnotationBuffer.append("<").append(elemRawName).append(" ");

    // attributes are a bit of a pain.  To get this right, we have to keep track
    // of the namespaces we've seen declared, then examine the namespace context
    // for other namespaces so that we can also include them.
    // optimized for simplicity and the case that not many
    // namespaces are declared on this annotation...
    ArrayList namespaces = new ArrayList();
    for (int i = 0; i < attributes.getLength(); ++i) {
        String aValue = attributes.getValue(i);
        String aPrefix = attributes.getPrefix(i);
        String aQName = attributes.getQName(i);
        // if it's xmlns:* or xmlns, must be a namespace decl
        if (aPrefix == XMLSymbols.PREFIX_XMLNS || aQName == XMLSymbols.PREFIX_XMLNS) {
            namespaces.add(aPrefix == XMLSymbols.PREFIX_XMLNS ?
                    attributes.getLocalName(i) : XMLSymbols.EMPTY_STRING);
        }
        fAnnotationBuffer.append(aQName).append("=\"").append(processAttValue(aValue)).append("\" ");
    }
    // now we have to look through currently in-scope namespaces to see what
    // wasn't declared here
    Enumeration currPrefixes = namespaceContext.getAllPrefixes();
    while(currPrefixes.hasMoreElements()) {
        String prefix = (String)currPrefixes.nextElement();
        String uri = namespaceContext.getURI(prefix);
        if (uri == null) {
            uri = XMLSymbols.EMPTY_STRING;
        }
        if (!namespaces.contains(prefix)) {
            // have to declare this one
            if(prefix == XMLSymbols.EMPTY_STRING) {
                fAnnotationBuffer.append("xmlns").append("=\"").append(processAttValue(uri)).append("\" ");
            }
            else {
                fAnnotationBuffer.append("xmlns:").append(prefix).append("=\"").append(processAttValue(uri)).append("\" ");
            }
        }
    }
    fAnnotationBuffer.append(">\n");
}