Java Code Examples for com.sun.xml.internal.fastinfoset.EncodingConstants#XMLNS_NAMESPACE_NAME

The following examples show how to use com.sun.xml.internal.fastinfoset.EncodingConstants#XMLNS_NAMESPACE_NAME . 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: StAXDocumentSerializer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String namespaceURI, String localName,
    String value) throws XMLStreamException
{
    String prefix = "";

    // Find prefix for attribute, ignoring default namespace
    if (namespaceURI.length() > 0) {
        prefix = _nsContext.getNonDefaultPrefix(namespaceURI);

        // Undeclared prefix or ignorable default ns?
        if (prefix == null || prefix.length() == 0) {
            // Workaround for BUG in SAX NamespaceSupport helper
            // which incorrectly defines namespace declaration URI
            if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
                    namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
                // TODO
                // Need to check carefully the rule for the writing of
                // namespaces in StAX. Is it safe to ignore such
                // attributes, as declarations will be made using the
                // writeNamespace method
                return;
            }
            throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.URIUnbound", new Object[]{namespaceURI}));
        }
    }
    writeAttribute(prefix, namespaceURI, localName, value);
}
 
Example 2
Source File: StAXDocumentSerializer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String prefix, String namespaceURI,
    String localName, String value) throws XMLStreamException
{
    if (!_inStartElement) {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed"));
    }

    // TODO
    // Need to check carefully the rule for the writing of
    // namespaces in StAX. Is it safe to ignore such
    // attributes, as declarations will be made using the
    // writeNamespace method
    if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
            namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
        return;
    }

    if (_attributesArrayIndex == _attributesArray.length) {
        final String[] attributesArray = new String[_attributesArrayIndex * 2];
        System.arraycopy(_attributesArray, 0, attributesArray, 0, _attributesArrayIndex);
        _attributesArray = attributesArray;
    }

    _attributesArray[_attributesArrayIndex++] = namespaceURI;
    _attributesArray[_attributesArrayIndex++] = prefix;
    _attributesArray[_attributesArrayIndex++] = localName;
    _attributesArray[_attributesArrayIndex++] = value;
}
 
Example 3
Source File: StAXDocumentSerializer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String namespaceURI, String localName,
    String value) throws XMLStreamException
{
    String prefix = "";

    // Find prefix for attribute, ignoring default namespace
    if (namespaceURI.length() > 0) {
        prefix = _nsContext.getNonDefaultPrefix(namespaceURI);

        // Undeclared prefix or ignorable default ns?
        if (prefix == null || prefix.length() == 0) {
            // Workaround for BUG in SAX NamespaceSupport helper
            // which incorrectly defines namespace declaration URI
            if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
                    namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
                // TODO
                // Need to check carefully the rule for the writing of
                // namespaces in StAX. Is it safe to ignore such
                // attributes, as declarations will be made using the
                // writeNamespace method
                return;
            }
            throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.URIUnbound", new Object[]{namespaceURI}));
        }
    }
    writeAttribute(prefix, namespaceURI, localName, value);
}
 
Example 4
Source File: StAXDocumentSerializer.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String prefix, String namespaceURI,
    String localName, String value) throws XMLStreamException
{
    if (!_inStartElement) {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed"));
    }

    // TODO
    // Need to check carefully the rule for the writing of
    // namespaces in StAX. Is it safe to ignore such
    // attributes, as declarations will be made using the
    // writeNamespace method
    if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
            namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
        return;
    }

    if (_attributesArrayIndex == _attributesArray.length) {
        final String[] attributesArray = new String[_attributesArrayIndex * 2];
        System.arraycopy(_attributesArray, 0, attributesArray, 0, _attributesArrayIndex);
        _attributesArray = attributesArray;
    }

    _attributesArray[_attributesArrayIndex++] = namespaceURI;
    _attributesArray[_attributesArrayIndex++] = prefix;
    _attributesArray[_attributesArrayIndex++] = localName;
    _attributesArray[_attributesArrayIndex++] = value;
}
 
Example 5
Source File: StAXDocumentSerializer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String namespaceURI, String localName,
    String value) throws XMLStreamException
{
    String prefix = "";

    // Find prefix for attribute, ignoring default namespace
    if (namespaceURI.length() > 0) {
        prefix = _nsContext.getNonDefaultPrefix(namespaceURI);

        // Undeclared prefix or ignorable default ns?
        if (prefix == null || prefix.length() == 0) {
            // Workaround for BUG in SAX NamespaceSupport helper
            // which incorrectly defines namespace declaration URI
            if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
                    namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
                // TODO
                // Need to check carefully the rule for the writing of
                // namespaces in StAX. Is it safe to ignore such
                // attributes, as declarations will be made using the
                // writeNamespace method
                return;
            }
            throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.URIUnbound", new Object[]{namespaceURI}));
        }
    }
    writeAttribute(prefix, namespaceURI, localName, value);
}
 
Example 6
Source File: StAXDocumentSerializer.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String prefix, String namespaceURI,
    String localName, String value) throws XMLStreamException
{
    if (!_inStartElement) {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed"));
    }

    // TODO
    // Need to check carefully the rule for the writing of
    // namespaces in StAX. Is it safe to ignore such
    // attributes, as declarations will be made using the
    // writeNamespace method
    if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
            namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
        return;
    }

    if (_attributesArrayIndex == _attributesArray.length) {
        final String[] attributesArray = new String[_attributesArrayIndex * 2];
        System.arraycopy(_attributesArray, 0, attributesArray, 0, _attributesArrayIndex);
        _attributesArray = attributesArray;
    }

    _attributesArray[_attributesArrayIndex++] = namespaceURI;
    _attributesArray[_attributesArrayIndex++] = prefix;
    _attributesArray[_attributesArrayIndex++] = localName;
    _attributesArray[_attributesArrayIndex++] = value;
}
 
Example 7
Source File: StAXDocumentSerializer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String namespaceURI, String localName,
    String value) throws XMLStreamException
{
    String prefix = "";

    // Find prefix for attribute, ignoring default namespace
    if (namespaceURI.length() > 0) {
        prefix = _nsContext.getNonDefaultPrefix(namespaceURI);

        // Undeclared prefix or ignorable default ns?
        if (prefix == null || prefix.length() == 0) {
            // Workaround for BUG in SAX NamespaceSupport helper
            // which incorrectly defines namespace declaration URI
            if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
                    namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
                // TODO
                // Need to check carefully the rule for the writing of
                // namespaces in StAX. Is it safe to ignore such
                // attributes, as declarations will be made using the
                // writeNamespace method
                return;
            }
            throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.URIUnbound", new Object[]{namespaceURI}));
        }
    }
    writeAttribute(prefix, namespaceURI, localName, value);
}
 
Example 8
Source File: StAXDocumentSerializer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String prefix, String namespaceURI,
    String localName, String value) throws XMLStreamException
{
    if (!_inStartElement) {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed"));
    }

    // TODO
    // Need to check carefully the rule for the writing of
    // namespaces in StAX. Is it safe to ignore such
    // attributes, as declarations will be made using the
    // writeNamespace method
    if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
            namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
        return;
    }

    if (_attributesArrayIndex == _attributesArray.length) {
        final String[] attributesArray = new String[_attributesArrayIndex * 2];
        System.arraycopy(_attributesArray, 0, attributesArray, 0, _attributesArrayIndex);
        _attributesArray = attributesArray;
    }

    _attributesArray[_attributesArrayIndex++] = namespaceURI;
    _attributesArray[_attributesArrayIndex++] = prefix;
    _attributesArray[_attributesArrayIndex++] = localName;
    _attributesArray[_attributesArrayIndex++] = value;
}
 
Example 9
Source File: StAXDocumentSerializer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String namespaceURI, String localName,
    String value) throws XMLStreamException
{
    String prefix = "";

    // Find prefix for attribute, ignoring default namespace
    if (namespaceURI.length() > 0) {
        prefix = _nsContext.getNonDefaultPrefix(namespaceURI);

        // Undeclared prefix or ignorable default ns?
        if (prefix == null || prefix.length() == 0) {
            // Workaround for BUG in SAX NamespaceSupport helper
            // which incorrectly defines namespace declaration URI
            if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
                    namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
                // TODO
                // Need to check carefully the rule for the writing of
                // namespaces in StAX. Is it safe to ignore such
                // attributes, as declarations will be made using the
                // writeNamespace method
                return;
            }
            throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.URIUnbound", new Object[]{namespaceURI}));
        }
    }
    writeAttribute(prefix, namespaceURI, localName, value);
}
 
Example 10
Source File: StAXDocumentSerializer.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String prefix, String namespaceURI,
    String localName, String value) throws XMLStreamException
{
    if (!_inStartElement) {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed"));
    }

    // TODO
    // Need to check carefully the rule for the writing of
    // namespaces in StAX. Is it safe to ignore such
    // attributes, as declarations will be made using the
    // writeNamespace method
    if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
            namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
        return;
    }

    if (_attributesArrayIndex == _attributesArray.length) {
        final String[] attributesArray = new String[_attributesArrayIndex * 2];
        System.arraycopy(_attributesArray, 0, attributesArray, 0, _attributesArrayIndex);
        _attributesArray = attributesArray;
    }

    _attributesArray[_attributesArrayIndex++] = namespaceURI;
    _attributesArray[_attributesArrayIndex++] = prefix;
    _attributesArray[_attributesArrayIndex++] = localName;
    _attributesArray[_attributesArrayIndex++] = value;
}
 
Example 11
Source File: StAXDocumentSerializer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String namespaceURI, String localName,
    String value) throws XMLStreamException
{
    String prefix = "";

    // Find prefix for attribute, ignoring default namespace
    if (namespaceURI.length() > 0) {
        prefix = _nsContext.getNonDefaultPrefix(namespaceURI);

        // Undeclared prefix or ignorable default ns?
        if (prefix == null || prefix.length() == 0) {
            // Workaround for BUG in SAX NamespaceSupport helper
            // which incorrectly defines namespace declaration URI
            if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
                    namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
                // TODO
                // Need to check carefully the rule for the writing of
                // namespaces in StAX. Is it safe to ignore such
                // attributes, as declarations will be made using the
                // writeNamespace method
                return;
            }
            throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.URIUnbound", new Object[]{namespaceURI}));
        }
    }
    writeAttribute(prefix, namespaceURI, localName, value);
}
 
Example 12
Source File: StAXDocumentSerializer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String prefix, String namespaceURI,
    String localName, String value) throws XMLStreamException
{
    if (!_inStartElement) {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed"));
    }

    // TODO
    // Need to check carefully the rule for the writing of
    // namespaces in StAX. Is it safe to ignore such
    // attributes, as declarations will be made using the
    // writeNamespace method
    if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
            namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
        return;
    }

    if (_attributesArrayIndex == _attributesArray.length) {
        final String[] attributesArray = new String[_attributesArrayIndex * 2];
        System.arraycopy(_attributesArray, 0, attributesArray, 0, _attributesArrayIndex);
        _attributesArray = attributesArray;
    }

    _attributesArray[_attributesArrayIndex++] = namespaceURI;
    _attributesArray[_attributesArrayIndex++] = prefix;
    _attributesArray[_attributesArrayIndex++] = localName;
    _attributesArray[_attributesArrayIndex++] = value;
}
 
Example 13
Source File: StAXDocumentSerializer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String namespaceURI, String localName,
    String value) throws XMLStreamException
{
    String prefix = "";

    // Find prefix for attribute, ignoring default namespace
    if (namespaceURI.length() > 0) {
        prefix = _nsContext.getNonDefaultPrefix(namespaceURI);

        // Undeclared prefix or ignorable default ns?
        if (prefix == null || prefix.length() == 0) {
            // Workaround for BUG in SAX NamespaceSupport helper
            // which incorrectly defines namespace declaration URI
            if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
                    namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
                // TODO
                // Need to check carefully the rule for the writing of
                // namespaces in StAX. Is it safe to ignore such
                // attributes, as declarations will be made using the
                // writeNamespace method
                return;
            }
            throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.URIUnbound", new Object[]{namespaceURI}));
        }
    }
    writeAttribute(prefix, namespaceURI, localName, value);
}
 
Example 14
Source File: StAXDocumentSerializer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String prefix, String namespaceURI,
    String localName, String value) throws XMLStreamException
{
    if (!_inStartElement) {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed"));
    }

    // TODO
    // Need to check carefully the rule for the writing of
    // namespaces in StAX. Is it safe to ignore such
    // attributes, as declarations will be made using the
    // writeNamespace method
    if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
            namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
        return;
    }

    if (_attributesArrayIndex == _attributesArray.length) {
        final String[] attributesArray = new String[_attributesArrayIndex * 2];
        System.arraycopy(_attributesArray, 0, attributesArray, 0, _attributesArrayIndex);
        _attributesArray = attributesArray;
    }

    _attributesArray[_attributesArrayIndex++] = namespaceURI;
    _attributesArray[_attributesArrayIndex++] = prefix;
    _attributesArray[_attributesArrayIndex++] = localName;
    _attributesArray[_attributesArrayIndex++] = value;
}
 
Example 15
Source File: StAXDocumentSerializer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String namespaceURI, String localName,
    String value) throws XMLStreamException
{
    String prefix = "";

    // Find prefix for attribute, ignoring default namespace
    if (namespaceURI.length() > 0) {
        prefix = _nsContext.getNonDefaultPrefix(namespaceURI);

        // Undeclared prefix or ignorable default ns?
        if (prefix == null || prefix.length() == 0) {
            // Workaround for BUG in SAX NamespaceSupport helper
            // which incorrectly defines namespace declaration URI
            if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
                    namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
                // TODO
                // Need to check carefully the rule for the writing of
                // namespaces in StAX. Is it safe to ignore such
                // attributes, as declarations will be made using the
                // writeNamespace method
                return;
            }
            throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.URIUnbound", new Object[]{namespaceURI}));
        }
    }
    writeAttribute(prefix, namespaceURI, localName, value);
}
 
Example 16
Source File: StAXDocumentSerializer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String prefix, String namespaceURI,
    String localName, String value) throws XMLStreamException
{
    if (!_inStartElement) {
        throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed"));
    }

    // TODO
    // Need to check carefully the rule for the writing of
    // namespaces in StAX. Is it safe to ignore such
    // attributes, as declarations will be made using the
    // writeNamespace method
    if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
            namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
        return;
    }

    if (_attributesArrayIndex == _attributesArray.length) {
        final String[] attributesArray = new String[_attributesArrayIndex * 2];
        System.arraycopy(_attributesArray, 0, attributesArray, 0, _attributesArrayIndex);
        _attributesArray = attributesArray;
    }

    _attributesArray[_attributesArrayIndex++] = namespaceURI;
    _attributesArray[_attributesArrayIndex++] = prefix;
    _attributesArray[_attributesArrayIndex++] = localName;
    _attributesArray[_attributesArrayIndex++] = value;
}