当前位置: 首页>>代码示例>>Java>>正文


Java EncodingConstants.ELEMENT属性代码示例

本文整理汇总了Java中com.sun.xml.internal.fastinfoset.EncodingConstants.ELEMENT属性的典型用法代码示例。如果您正苦于以下问题:Java EncodingConstants.ELEMENT属性的具体用法?Java EncodingConstants.ELEMENT怎么用?Java EncodingConstants.ELEMENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.sun.xml.internal.fastinfoset.EncodingConstants的用法示例。


在下文中一共展示了EncodingConstants.ELEMENT属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: beginStartTag

@Override
public void beginStartTag(int prefix, String localName) throws IOException {
    fiout.writeLowLevelTerminationAndMark();

    int type = EncodingConstants.ELEMENT;
    if (nsContext.getCurrent().count() > 0) {
        final NamespaceContextImpl.Element nse = nsContext.getCurrent();

        fiout.writeLowLevelStartNamespaces();
        for (int i = nse.count() - 1; i >= 0; i--) {
            final String uri = nse.getNsUri(i);
            if (uri.length() == 0 && nse.getBase() == 1)
                continue;   // no point in definint xmlns='' on the root
            fiout.writeLowLevelNamespace(nse.getPrefix(i), uri);
        }
        fiout.writeLowLevelEndNamespaces();

        type= 0;
    }

    final boolean isIndexed = fiout.writeLowLevelStartElement(
            type,
            nsContext.getPrefix(prefix),
            localName,
            nsContext.getNamespaceURI(prefix));

    if (!isIndexed)
        tables.incrementMaxIndexValue();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:FastInfosetStreamWriterOutput.java

示例2: encodeTerminationAndCurrentElement

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);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:70,代码来源:StAXDocumentSerializer.java


注:本文中的com.sun.xml.internal.fastinfoset.EncodingConstants.ELEMENT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。