public final void _handleEndObject() throws IOException { // We may want to repeat same element, so: if (_elementNameStack.isEmpty()) { throw new JsonGenerationException("Can not write END_ELEMENT without open START_ELEMENT", this); } _nextName = _elementNameStack.removeLast(); try { // note: since attributes don't nest, can only have one attribute active, so: _nextIsAttribute = false; _xmlWriter.writeEndElement(); // [databind-xml#172]: possibly also need indentation if (_elementNameStack.isEmpty() && (_xmlPrettyPrinter != null)) { // ... but only if it is likely to succeed: if (!_stax2Emulation) { _xmlPrettyPrinter.writePrologLinefeed(_xmlWriter); } } } catch (XMLStreamException e) { StaxUtil.throwAsGenerationException(e, this); } }
public final void _handleEndObject() throws IOException { // We may want to repeat same element, so: if (_elementNameStack.isEmpty()) { throw new JsonGenerationException("Can not write END_ELEMENT without open START_ELEMENT", this); } _nextName = _elementNameStack.removeLast(); try { // note: since attributes don't nest, can only have one attribute active, so: _nextIsAttribute = false; _xmlWriter.writeEndElement(); // [databind-xml#172]: possibly also need indentation if (_elementNameStack.isEmpty() && (_xmlPrettyPrinter != null)) { // ... but only if it is likely to succeed: if (!_stax2Emulation) { _xmlPrettyPrinter.writePrologLinefeed(_xmlWriter); } } } catch (XMLStreamException e) { StaxUtil.throwXmlAsIOException(e); } }
/** * Method called before writing any other output, to optionally * output XML declaration. */ public void initGenerator() throws IOException { if (_initialized) { return; } _initialized = true; try { if (Feature.WRITE_XML_1_1.enabledIn(_formatFeatures)) { _xmlWriter.writeStartDocument("UTF-8", "1.1"); } else if (Feature.WRITE_XML_DECLARATION.enabledIn(_formatFeatures)) { _xmlWriter.writeStartDocument("UTF-8", "1.0"); } else { return; } // as per [dataformat-xml#172], try adding indentation if (_xmlPrettyPrinter != null) { // ... but only if it is likely to succeed: if (!_stax2Emulation) { _xmlPrettyPrinter.writePrologLinefeed(_xmlWriter); } } } catch (XMLStreamException e) { StaxUtil.throwAsGenerationException(e, this); } }
/** * Method called before writing any other output, to optionally * output XML declaration. */ public void initGenerator() throws IOException { if (_initialized) { return; } _initialized = true; try { if (Feature.WRITE_XML_1_1.enabledIn(_formatFeatures)) { _xmlWriter.writeStartDocument("UTF-8", "1.1"); } else if (Feature.WRITE_XML_DECLARATION.enabledIn(_formatFeatures)) { _xmlWriter.writeStartDocument("UTF-8", "1.0"); } else { return; } // as per [dataformat-xml#172], try adding indentation if (_xmlPrettyPrinter != null) { // ... but only if it is likely to succeed: if (!_stax2Emulation) { _xmlPrettyPrinter.writePrologLinefeed(_xmlWriter); } } } catch (XMLStreamException e) { StaxUtil.throwXmlAsIOException(e); } }