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

The following examples show how to use com.sun.xml.internal.fastinfoset.EncodingConstants#ELEMENT_ATTRIBUTE_FLAG . 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 4 votes vote down vote up
protected void encodeTerminationAndCurrentElement(boolean terminateAfter) throws XMLStreamException {
    try {
        encodeTermination();

        if (_inStartElement) {

            _b = EncodingConstants.ELEMENT;
            if (_attributesArrayIndex > 0) {
                _b |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
            }

            // Encode namespace decls associated with this element
            if (_namespacesArrayIndex > 0) {
                write(_b | EncodingConstants.ELEMENT_NAMESPACES_FLAG);
                for (int i = 0; i < _namespacesArrayIndex;) {
                    encodeNamespaceAttribute(_namespacesArray[i++], _namespacesArray[i++]);
                }
                _namespacesArrayIndex = 0;

                write(EncodingConstants.TERMINATOR);

                _b = 0;
            }

            // If element's prefix is empty - apply default scope namespace
            if (_currentPrefix.length() == 0) {
                if (_currentUri.length() == 0) {
                    _currentUri = _nsContext.getNamespaceURI("");
                } else {
                    String tmpPrefix = getPrefix(_currentUri);
                    if (tmpPrefix != null) {
                        _currentPrefix = tmpPrefix;
                    }
                }
            }

            encodeElementQualifiedNameOnThirdBit(_currentUri, _currentPrefix, _currentLocalName);

            for (int i = 0; i < _attributesArrayIndex;) {
                encodeAttributeQualifiedNameOnSecondBit(
                        _attributesArray[i++], _attributesArray[i++], _attributesArray[i++]);

                final String value = _attributesArray[i];
                _attributesArray[i++] = null;
                final boolean addToTable = isAttributeValueLengthMatchesLimit(value.length());
                encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false);

                _b = EncodingConstants.TERMINATOR;
                _terminate = true;
            }
            _attributesArrayIndex = 0;
            _inStartElement = false;

            if (_isEmptyElement) {
                encodeElementTermination();
                if (_nsSupportContextStack[_stackCount--] == true) {
                    _nsContext.popContext();
                }

                _isEmptyElement = false;
            }

            if (terminateAfter) {
                encodeTermination();
            }
        }
    } catch (IOException e) {
        throw new XMLStreamException(e);
    }
}
 
Example 2
Source File: StAXDocumentSerializer.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
public final void writeLowLevelStartAttributes() throws IOException {
    if (hasMark()) {
        _octetBuffer[_markIndex] |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
        resetMark();
    }
}
 
Example 3
Source File: StAXDocumentSerializer.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected void encodeTerminationAndCurrentElement(boolean terminateAfter) throws XMLStreamException {
    try {
        encodeTermination();

        if (_inStartElement) {

            _b = EncodingConstants.ELEMENT;
            if (_attributesArrayIndex > 0) {
                _b |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
            }

            // Encode namespace decls associated with this element
            if (_namespacesArrayIndex > 0) {
                write(_b | EncodingConstants.ELEMENT_NAMESPACES_FLAG);
                for (int i = 0; i < _namespacesArrayIndex;) {
                    encodeNamespaceAttribute(_namespacesArray[i++], _namespacesArray[i++]);
                }
                _namespacesArrayIndex = 0;

                write(EncodingConstants.TERMINATOR);

                _b = 0;
            }

            // If element's prefix is empty - apply default scope namespace
            if (_currentPrefix.length() == 0) {
                if (_currentUri.length() == 0) {
                    _currentUri = _nsContext.getNamespaceURI("");
                } else {
                    String tmpPrefix = getPrefix(_currentUri);
                    if (tmpPrefix != null) {
                        _currentPrefix = tmpPrefix;
                    }
                }
            }

            encodeElementQualifiedNameOnThirdBit(_currentUri, _currentPrefix, _currentLocalName);

            for (int i = 0; i < _attributesArrayIndex;) {
                encodeAttributeQualifiedNameOnSecondBit(
                        _attributesArray[i++], _attributesArray[i++], _attributesArray[i++]);

                final String value = _attributesArray[i];
                _attributesArray[i++] = null;
                final boolean addToTable = isAttributeValueLengthMatchesLimit(value.length());
                encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false);

                _b = EncodingConstants.TERMINATOR;
                _terminate = true;
            }
            _attributesArrayIndex = 0;
            _inStartElement = false;

            if (_isEmptyElement) {
                encodeElementTermination();
                if (_nsSupportContextStack[_stackCount--] == true) {
                    _nsContext.popContext();
                }

                _isEmptyElement = false;
            }

            if (terminateAfter) {
                encodeTermination();
            }
        }
    } catch (IOException e) {
        throw new XMLStreamException(e);
    }
}
 
Example 4
Source File: StAXDocumentSerializer.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
public final void writeLowLevelStartAttributes() throws IOException {
    if (hasMark()) {
        _octetBuffer[_markIndex] |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
        resetMark();
    }
}
 
Example 5
Source File: StAXDocumentSerializer.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected void encodeTerminationAndCurrentElement(boolean terminateAfter) throws XMLStreamException {
    try {
        encodeTermination();

        if (_inStartElement) {

            _b = EncodingConstants.ELEMENT;
            if (_attributesArrayIndex > 0) {
                _b |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
            }

            // Encode namespace decls associated with this element
            if (_namespacesArrayIndex > 0) {
                write(_b | EncodingConstants.ELEMENT_NAMESPACES_FLAG);
                for (int i = 0; i < _namespacesArrayIndex;) {
                    encodeNamespaceAttribute(_namespacesArray[i++], _namespacesArray[i++]);
                }
                _namespacesArrayIndex = 0;

                write(EncodingConstants.TERMINATOR);

                _b = 0;
            }

            // If element's prefix is empty - apply default scope namespace
            if (_currentPrefix.length() == 0) {
                if (_currentUri.length() == 0) {
                    _currentUri = _nsContext.getNamespaceURI("");
                } else {
                    String tmpPrefix = getPrefix(_currentUri);
                    if (tmpPrefix != null) {
                        _currentPrefix = tmpPrefix;
                    }
                }
            }

            encodeElementQualifiedNameOnThirdBit(_currentUri, _currentPrefix, _currentLocalName);

            for (int i = 0; i < _attributesArrayIndex;) {
                encodeAttributeQualifiedNameOnSecondBit(
                        _attributesArray[i++], _attributesArray[i++], _attributesArray[i++]);

                final String value = _attributesArray[i];
                _attributesArray[i++] = null;
                final boolean addToTable = isAttributeValueLengthMatchesLimit(value.length());
                encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false);

                _b = EncodingConstants.TERMINATOR;
                _terminate = true;
            }
            _attributesArrayIndex = 0;
            _inStartElement = false;

            if (_isEmptyElement) {
                encodeElementTermination();
                if (_nsSupportContextStack[_stackCount--] == true) {
                    _nsContext.popContext();
                }

                _isEmptyElement = false;
            }

            if (terminateAfter) {
                encodeTermination();
            }
        }
    } catch (IOException e) {
        throw new XMLStreamException(e);
    }
}
 
Example 6
Source File: StAXDocumentSerializer.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public final void writeLowLevelStartAttributes() throws IOException {
    if (hasMark()) {
        _octetBuffer[_markIndex] |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
        resetMark();
    }
}
 
Example 7
Source File: StAXDocumentSerializer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected void encodeTerminationAndCurrentElement(boolean terminateAfter) throws XMLStreamException {
    try {
        encodeTermination();

        if (_inStartElement) {

            _b = EncodingConstants.ELEMENT;
            if (_attributesArrayIndex > 0) {
                _b |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
            }

            // Encode namespace decls associated with this element
            if (_namespacesArrayIndex > 0) {
                write(_b | EncodingConstants.ELEMENT_NAMESPACES_FLAG);
                for (int i = 0; i < _namespacesArrayIndex;) {
                    encodeNamespaceAttribute(_namespacesArray[i++], _namespacesArray[i++]);
                }
                _namespacesArrayIndex = 0;

                write(EncodingConstants.TERMINATOR);

                _b = 0;
            }

            // If element's prefix is empty - apply default scope namespace
            if (_currentPrefix.length() == 0) {
                if (_currentUri.length() == 0) {
                    _currentUri = _nsContext.getNamespaceURI("");
                } else {
                    String tmpPrefix = getPrefix(_currentUri);
                    if (tmpPrefix != null) {
                        _currentPrefix = tmpPrefix;
                    }
                }
            }

            encodeElementQualifiedNameOnThirdBit(_currentUri, _currentPrefix, _currentLocalName);

            for (int i = 0; i < _attributesArrayIndex;) {
                encodeAttributeQualifiedNameOnSecondBit(
                        _attributesArray[i++], _attributesArray[i++], _attributesArray[i++]);

                final String value = _attributesArray[i];
                _attributesArray[i++] = null;
                final boolean addToTable = isAttributeValueLengthMatchesLimit(value.length());
                encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false);

                _b = EncodingConstants.TERMINATOR;
                _terminate = true;
            }
            _attributesArrayIndex = 0;
            _inStartElement = false;

            if (_isEmptyElement) {
                encodeElementTermination();
                if (_nsSupportContextStack[_stackCount--] == true) {
                    _nsContext.popContext();
                }

                _isEmptyElement = false;
            }

            if (terminateAfter) {
                encodeTermination();
            }
        }
    } catch (IOException e) {
        throw new XMLStreamException(e);
    }
}
 
Example 8
Source File: StAXDocumentSerializer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public final void writeLowLevelStartAttributes() throws IOException {
    if (hasMark()) {
        _octetBuffer[_markIndex] |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
        resetMark();
    }
}
 
Example 9
Source File: StAXDocumentSerializer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected void encodeTerminationAndCurrentElement(boolean terminateAfter) throws XMLStreamException {
    try {
        encodeTermination();

        if (_inStartElement) {

            _b = EncodingConstants.ELEMENT;
            if (_attributesArrayIndex > 0) {
                _b |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
            }

            // Encode namespace decls associated with this element
            if (_namespacesArrayIndex > 0) {
                write(_b | EncodingConstants.ELEMENT_NAMESPACES_FLAG);
                for (int i = 0; i < _namespacesArrayIndex;) {
                    encodeNamespaceAttribute(_namespacesArray[i++], _namespacesArray[i++]);
                }
                _namespacesArrayIndex = 0;

                write(EncodingConstants.TERMINATOR);

                _b = 0;
            }

            // If element's prefix is empty - apply default scope namespace
            if (_currentPrefix.length() == 0) {
                if (_currentUri.length() == 0) {
                    _currentUri = _nsContext.getNamespaceURI("");
                } else {
                    String tmpPrefix = getPrefix(_currentUri);
                    if (tmpPrefix != null) {
                        _currentPrefix = tmpPrefix;
                    }
                }
            }

            encodeElementQualifiedNameOnThirdBit(_currentUri, _currentPrefix, _currentLocalName);

            for (int i = 0; i < _attributesArrayIndex;) {
                encodeAttributeQualifiedNameOnSecondBit(
                        _attributesArray[i++], _attributesArray[i++], _attributesArray[i++]);

                final String value = _attributesArray[i];
                _attributesArray[i++] = null;
                final boolean addToTable = isAttributeValueLengthMatchesLimit(value.length());
                encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false);

                _b = EncodingConstants.TERMINATOR;
                _terminate = true;
            }
            _attributesArrayIndex = 0;
            _inStartElement = false;

            if (_isEmptyElement) {
                encodeElementTermination();
                if (_nsSupportContextStack[_stackCount--] == true) {
                    _nsContext.popContext();
                }

                _isEmptyElement = false;
            }

            if (terminateAfter) {
                encodeTermination();
            }
        }
    } catch (IOException e) {
        throw new XMLStreamException(e);
    }
}
 
Example 10
Source File: StAXDocumentSerializer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public final void writeLowLevelStartAttributes() throws IOException {
    if (hasMark()) {
        _octetBuffer[_markIndex] |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
        resetMark();
    }
}
 
Example 11
Source File: StAXDocumentSerializer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected void encodeTerminationAndCurrentElement(boolean terminateAfter) throws XMLStreamException {
    try {
        encodeTermination();

        if (_inStartElement) {

            _b = EncodingConstants.ELEMENT;
            if (_attributesArrayIndex > 0) {
                _b |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
            }

            // Encode namespace decls associated with this element
            if (_namespacesArrayIndex > 0) {
                write(_b | EncodingConstants.ELEMENT_NAMESPACES_FLAG);
                for (int i = 0; i < _namespacesArrayIndex;) {
                    encodeNamespaceAttribute(_namespacesArray[i++], _namespacesArray[i++]);
                }
                _namespacesArrayIndex = 0;

                write(EncodingConstants.TERMINATOR);

                _b = 0;
            }

            // If element's prefix is empty - apply default scope namespace
            if (_currentPrefix.length() == 0) {
                if (_currentUri.length() == 0) {
                    _currentUri = _nsContext.getNamespaceURI("");
                } else {
                    String tmpPrefix = getPrefix(_currentUri);
                    if (tmpPrefix != null) {
                        _currentPrefix = tmpPrefix;
                    }
                }
            }

            encodeElementQualifiedNameOnThirdBit(_currentUri, _currentPrefix, _currentLocalName);

            for (int i = 0; i < _attributesArrayIndex;) {
                encodeAttributeQualifiedNameOnSecondBit(
                        _attributesArray[i++], _attributesArray[i++], _attributesArray[i++]);

                final String value = _attributesArray[i];
                _attributesArray[i++] = null;
                final boolean addToTable = isAttributeValueLengthMatchesLimit(value.length());
                encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false);

                _b = EncodingConstants.TERMINATOR;
                _terminate = true;
            }
            _attributesArrayIndex = 0;
            _inStartElement = false;

            if (_isEmptyElement) {
                encodeElementTermination();
                if (_nsSupportContextStack[_stackCount--] == true) {
                    _nsContext.popContext();
                }

                _isEmptyElement = false;
            }

            if (terminateAfter) {
                encodeTermination();
            }
        }
    } catch (IOException e) {
        throw new XMLStreamException(e);
    }
}
 
Example 12
Source File: StAXDocumentSerializer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
public final void writeLowLevelStartAttributes() throws IOException {
    if (hasMark()) {
        _octetBuffer[_markIndex] |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
        resetMark();
    }
}
 
Example 13
Source File: StAXDocumentSerializer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
protected void encodeTerminationAndCurrentElement(boolean terminateAfter) throws XMLStreamException {
    try {
        encodeTermination();

        if (_inStartElement) {

            _b = EncodingConstants.ELEMENT;
            if (_attributesArrayIndex > 0) {
                _b |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
            }

            // Encode namespace decls associated with this element
            if (_namespacesArrayIndex > 0) {
                write(_b | EncodingConstants.ELEMENT_NAMESPACES_FLAG);
                for (int i = 0; i < _namespacesArrayIndex;) {
                    encodeNamespaceAttribute(_namespacesArray[i++], _namespacesArray[i++]);
                }
                _namespacesArrayIndex = 0;

                write(EncodingConstants.TERMINATOR);

                _b = 0;
            }

            // If element's prefix is empty - apply default scope namespace
            if (_currentPrefix.length() == 0) {
                if (_currentUri.length() == 0) {
                    _currentUri = _nsContext.getNamespaceURI("");
                } else {
                    String tmpPrefix = getPrefix(_currentUri);
                    if (tmpPrefix != null) {
                        _currentPrefix = tmpPrefix;
                    }
                }
            }

            encodeElementQualifiedNameOnThirdBit(_currentUri, _currentPrefix, _currentLocalName);

            for (int i = 0; i < _attributesArrayIndex;) {
                encodeAttributeQualifiedNameOnSecondBit(
                        _attributesArray[i++], _attributesArray[i++], _attributesArray[i++]);

                final String value = _attributesArray[i];
                _attributesArray[i++] = null;
                final boolean addToTable = isAttributeValueLengthMatchesLimit(value.length());
                encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false);

                _b = EncodingConstants.TERMINATOR;
                _terminate = true;
            }
            _attributesArrayIndex = 0;
            _inStartElement = false;

            if (_isEmptyElement) {
                encodeElementTermination();
                if (_nsSupportContextStack[_stackCount--] == true) {
                    _nsContext.popContext();
                }

                _isEmptyElement = false;
            }

            if (terminateAfter) {
                encodeTermination();
            }
        }
    } catch (IOException e) {
        throw new XMLStreamException(e);
    }
}
 
Example 14
Source File: StAXDocumentSerializer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public final void writeLowLevelStartAttributes() throws IOException {
    if (hasMark()) {
        _octetBuffer[_markIndex] |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
        resetMark();
    }
}
 
Example 15
Source File: StAXDocumentSerializer.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
protected void encodeTerminationAndCurrentElement(boolean terminateAfter) throws XMLStreamException {
    try {
        encodeTermination();

        if (_inStartElement) {

            _b = EncodingConstants.ELEMENT;
            if (_attributesArrayIndex > 0) {
                _b |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
            }

            // Encode namespace decls associated with this element
            if (_namespacesArrayIndex > 0) {
                write(_b | EncodingConstants.ELEMENT_NAMESPACES_FLAG);
                for (int i = 0; i < _namespacesArrayIndex;) {
                    encodeNamespaceAttribute(_namespacesArray[i++], _namespacesArray[i++]);
                }
                _namespacesArrayIndex = 0;

                write(EncodingConstants.TERMINATOR);

                _b = 0;
            }

            // If element's prefix is empty - apply default scope namespace
            if (_currentPrefix.length() == 0) {
                if (_currentUri.length() == 0) {
                    _currentUri = _nsContext.getNamespaceURI("");
                } else {
                    String tmpPrefix = getPrefix(_currentUri);
                    if (tmpPrefix != null) {
                        _currentPrefix = tmpPrefix;
                    }
                }
            }

            encodeElementQualifiedNameOnThirdBit(_currentUri, _currentPrefix, _currentLocalName);

            for (int i = 0; i < _attributesArrayIndex;) {
                encodeAttributeQualifiedNameOnSecondBit(
                        _attributesArray[i++], _attributesArray[i++], _attributesArray[i++]);

                final String value = _attributesArray[i];
                _attributesArray[i++] = null;
                final boolean addToTable = isAttributeValueLengthMatchesLimit(value.length());
                encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false);

                _b = EncodingConstants.TERMINATOR;
                _terminate = true;
            }
            _attributesArrayIndex = 0;
            _inStartElement = false;

            if (_isEmptyElement) {
                encodeElementTermination();
                if (_nsSupportContextStack[_stackCount--] == true) {
                    _nsContext.popContext();
                }

                _isEmptyElement = false;
            }

            if (terminateAfter) {
                encodeTermination();
            }
        }
    } catch (IOException e) {
        throw new XMLStreamException(e);
    }
}
 
Example 16
Source File: StAXDocumentSerializer.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public final void writeLowLevelStartAttributes() throws IOException {
    if (hasMark()) {
        _octetBuffer[_markIndex] |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG;
        resetMark();
    }
}