/** * Copies an XML element (including all attributes and subnodes) from the given {@link * XMLStreamReader} to the given {@link XMLStreamWriter}. * * @param writer {@link XMLStreamWriter} that the xml is appended to * @param reader cursor must point at a <code>START_ELEMENT</code> event and points at the * corresponding <code>END_ELEMENT</code> event afterwards * @throws XMLStreamException */ public static void copy(XMLStreamWriter writer, XMLStreamReader reader) throws XMLStreamException { skipStartDocument(reader); XMLAdapter.writeElement(writer, reader); }
/** * Creates a {@link XMLStreamReader} out of an {@link OMElement} * * @param omElement the omElement to convert, never <code>null</code> * @return the omElement as {@link XMLStreamReader} the START_DOCUMENT node is skipped, never * <code>null</code> * @throws XMLStreamException if an error occurred creating the {@link XMLStreamReader} */ public static XMLStreamReader getAsXmlStrem(OMElement omElement) throws XMLStreamException { XMLStreamReader bodyXmlStream = omElement.getXMLStreamReaderWithoutCaching(); skipStartDocument(bodyXmlStream); return bodyXmlStream; }