String text = _collectUntilTag(); final boolean startElementNext = _xmlReader.getEventType() == XMLStreamReader.START_ELEMENT; if (text == null || _allWs(text)) { _mixedText = false; return _initStartElement(); return _handleEndElement(); return _initStartElement(); return _handleEndElement(); case XML_END: return XML_END; switch (_skipUntilTag()) { case XMLStreamConstants.END_DOCUMENT: return (_currentState = XML_END); case XMLStreamConstants.END_ELEMENT: return _handleEndElement(); return _initStartElement();
public int next() throws XMLStreamException { if (_repeatElement != 0) { return (_currentState = _handleRepeatElement()); } return _next(); }
@Override public void close() throws IOException { if (!_closed) { _closed = true; try { if (_ioContext.isResourceManaged() || isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)) { _xmlTokens.closeCompletely(); } else { _xmlTokens.close(); } } finally { // as per [JACKSON-324], do in finally block // Also, internal buffer(s) can now be released as well _releaseBuffers(); } } }
public JsonLocation getTokenLocation() { return _extractLocation(_xmlReader.getLocationInfo().getStartLocation()); }
public FromXmlParser(IOContext ctxt, int genericParserFeatures, int xmlFeatures, ObjectCodec codec, XMLStreamReader xmlReader) { super(genericParserFeatures); _formatFeatures = xmlFeatures; _ioContext = ctxt; _objectCodec = codec; _parsingContext = XmlReadContext.createRootContext(-1, -1); // and thereby start a scope _nextToken = JsonToken.START_OBJECT; _xmlTokens = new XmlTokenStream(xmlReader, ctxt.getSourceReference()); }
protected String convertToString() throws XMLStreamException { // only applicable to cases where START_OBJECT was induced by attributes if (_currentState != XML_ATTRIBUTE_NAME || _nextAttributeIndex != 0) { return null; } String text = _collectUntilTag(); // 23-Dec-2015, tatu: Used to require text not to be null, but as per // [dataformat-xml#167], empty tag does count if (_xmlReader.getEventType() == XMLStreamReader.END_ELEMENT) { if (text == null) { text = ""; } if (_currentWrapper != null) { _currentWrapper = _currentWrapper.getParent(); } // just for diagnostics, reset to element name (from first attribute name) _localName = _xmlReader.getLocalName(); _namespaceURI = _xmlReader.getNamespaceURI(); _attributeCount = 0; _currentState = XML_TEXT; _textValue = text; return text; } // Anything to do in failed case? Roll back whatever we found or.. ? return null; }
@Override public void close() throws IOException { if (!_closed) { _closed = true; try { if (_ioContext.isResourceManaged() || isEnabled(StreamReadFeature.AUTO_CLOSE_SOURCE)) { _xmlTokens.closeCompletely(); } else { _xmlTokens.close(); } } catch (XMLStreamException e) { StaxUtil.throwAsParseException(e, this); } finally { // Also, internal buffer(s) can now be released as well _releaseBuffers(); } } }
public JsonLocation getCurrentLocation() { return _extractLocation(_xmlReader.getLocationInfo().getCurrentLocation()); } public JsonLocation getTokenLocation() {
public FromXmlParser(ObjectReadContext readCtxt, IOContext ctxt, int parserFeatures, int xmlFeatures, XMLStreamReader xmlReader) { super(readCtxt, parserFeatures); _formatFeatures = xmlFeatures; _ioContext = ctxt; _parsingContext = XmlReadContext.createRootContext(-1, -1); // and thereby start a scope _nextToken = JsonToken.START_OBJECT; _xmlTokens = new XmlTokenStream(xmlReader, ctxt.getSourceReference(), _formatFeatures); }
String text = _collectUntilTag();
String text = _collectUntilTag(); final boolean startElementNext = _xmlReader.getEventType() == XMLStreamReader.START_ELEMENT; if (text == null || _allWs(text)) { _mixedText = false; return _initStartElement(); return _handleEndElement(); return _initStartElement(); return _handleEndElement(); case XML_END: return XML_END; switch (_skipUntilTag()) { case XMLStreamConstants.END_DOCUMENT: return (_currentState = XML_END); case XMLStreamConstants.END_ELEMENT: return _handleEndElement(); return _initStartElement();
public int next() throws IOException { if (_repeatElement != 0) { return (_currentState = _handleRepeatElement()); } try { return _next(); } catch (XMLStreamException e) { StaxUtil.throwXmlAsIOException(e); return -1; } }
public JsonLocation getCurrentLocation() { return _extractLocation(_xmlReader.getLocationInfo().getCurrentLocation()); }
public JsonLocation getTokenLocation() { return _extractLocation(_xmlReader.getLocationInfo().getStartLocation()); }