本文整理汇总了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();
}
示例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;
}
}
示例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);
}
}