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


Java XMLStreamReader.START_DOCUMENT属性代码示例

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


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

示例1: store

private void store(XMLStreamReader reader) throws XMLStreamException {
    if (!reader.hasNext()) {
        return;
    }

    _eventType = reader.getEventType();
    switch (_eventType) {
        case XMLStreamReader.START_DOCUMENT:
            storeDocumentAndChildren(reader);
            break;
        case XMLStreamReader.START_ELEMENT:
            storeElementAndChildren(reader);
            break;
        default:
            throw new XMLStreamException("XMLStreamReader not positioned at a document or element");
    }

    increaseTreeCount();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:19,代码来源:StreamReaderBufferCreator.java

示例2: soapBodyFirstChildReader

protected XMLStreamReader soapBodyFirstChildReader() {
    if (soapBodyFirstChildReader != null) return soapBodyFirstChildReader;
    soapBodyFirstChild();
    if (soapBodyFirstChild != null) {
        soapBodyFirstChildReader = getXMLStreamReader(soapBodyFirstChild);
        if (soapBodyFirstChildReader == null) soapBodyFirstChildReader =
            createXMLStreamReader(soapBodyFirstChild);
        if (soapBodyFirstChildReader.getEventType() == XMLStreamReader.START_DOCUMENT) {
            try {
                while(soapBodyFirstChildReader.getEventType() != XMLStreamReader.START_ELEMENT)
                    soapBodyFirstChildReader.next();
            } catch (XMLStreamException e) {
                throw new RuntimeException(e);
            }
        }
        return soapBodyFirstChildReader;
    } else {
        payloadLocalName = null;
        payloadNamespace = null;
        return null;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:22,代码来源:SAAJMessage.java

示例3: binaryInputStreamStreamToReader

private Reader binaryInputStreamStreamToReader(ByteArrayOutputStream out) {

        try {
            // There's got to be an easier way to do this, but I don't feel like coding up Appendix F of the XML Spec myself, when there's a reusable way to do
            // it, and we can warn folks away from BINARY xml streams that have to be parsed to determine the character encoding :P

            String encoding = "UTF-8";

            try {
                ByteArrayInputStream bIn = new ByteArrayInputStream(out.toByteArray());
                XMLStreamReader reader = this.inputFactory.createXMLStreamReader(bIn);

                int eventType = 0;

                while ((eventType = reader.next()) != XMLStreamReader.END_DOCUMENT) {
                    if (eventType == XMLStreamReader.START_DOCUMENT) {
                        String possibleEncoding = reader.getEncoding();

                        if (possibleEncoding != null) {
                            encoding = possibleEncoding;
                        }

                        break;
                    }
                }
            } catch (Throwable t) {
                // ignore, dealt with later when the string can't be parsed into valid XML
            }

            return new StringReader(new String(out.toByteArray(), encoding));
        } catch (UnsupportedEncodingException badEnc) {
            throw new RuntimeException(badEnc);
        }
    }
 
开发者ID:bragex,项目名称:the-vigilantes,代码行数:34,代码来源:JDBC4MysqlSQLXML.java


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