/** * Copies the current node and its children to the <code>writer</code>. * * @param in * @param writer the writer to write to * @throws javax.xml.stream.XMLStreamException */ public void copyNode(XMLStreamReader in, DcsStaxWriter writer) throws XMLStreamException { Assertion.notNull(in); Assertion.notNull(writer); copyNode(in, writer.getXMLStreamWriter()); }
public DcsStaxWriter createStreamWriter(OutputStream out) { try { outFactory.setProperty("javax.xml.stream.isRepairingNamespaces", true); return new DcsStaxWriter(qnames, outFactory.createXMLStreamWriter(out), false, true); } catch (XMLStreamException e) { log.error(e.getMessage(), e); } return null; }
/** * Copies the current node and its children to the <code>writer</code>. * * @param in * @param writer the writer to write to * @throws javax.xml.stream.XMLStreamException */ public void copyNode(XMLStreamReader in, DcsStaxWriter writer) throws XMLStreamException { Assertion.notNull(in); Assertion.notNull(writer); copyNode(in, writer.getXMLStreamWriter()); }
/** * Copies the current node and its children to the <code>sink</code>. * * @param in * @param out the output sink * @throws javax.xml.stream.XMLStreamException */ public void copyNode(String in, XMLStreamWriter out) throws XMLStreamException { Assertion.notNull(in); Assertion.notNull(out); copyNode(inputFactory.createXMLStreamReader(new StringReader(in)), out); }
/** * Copies the current node and its children to the <code>writer</code>. * * @param writer the writer to write to */ public void copyNode(DcsStaxWriter writer) throws XMLStreamException { Assertion.notNull(writer); final DcsStreamSupport dcsStream = new DcsStreamSupport(); dcsStream.copyNode(in, writer.getXMLStreamWriter()); }
/** * Copies the current node and its children to the <code>sink</code>. * * @param in * @param out the output sink * @throws javax.xml.stream.XMLStreamException */ public void copyNode(String in, XMLStreamWriter out) throws XMLStreamException { Assertion.notNull(in); Assertion.notNull(out); copyNode(inputFactory.createXMLStreamReader(new StringReader(in)), out); }
/** * Copies the current node and its children to the <code>writer</code>. * * @param in * @param writer the writer to write to * @throws javax.xml.stream.XMLStreamException */ public void copyNode(XMLStreamReader in, DcsStaxWriter writer) throws XMLStreamException { Assertion.notNull(in); Assertion.notNull(writer); copyNode(in, writer.getXMLStreamWriter()); }
/** * Copies the current node and its children to the <code>writer</code>. * * @param writer the writer to write to */ public void copyNode(DcsStaxWriter writer) throws XMLStreamException { Assertion.notNull(writer); final DcsStreamSupport dcsStream = new DcsStreamSupport(); dcsStream.copyNode(in, writer.getXMLStreamWriter()); }
public DcsStaxWriter createStreamWriter(OutputStream out) { try { outFactory.setProperty("javax.xml.stream.isRepairingNamespaces", true); return new DcsStaxWriter(qnames, outFactory.createXMLStreamWriter(out), false, true); } catch (XMLStreamException e) { log.error(e.getMessage(), e); } return null; }
@Override public void marshal(Object source, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(source, writer, context); // Inside <metadata> if (source instanceof DcsMetadata) { final DcsMetadata md = (DcsMetadata) source; final String schemaUri = md.getSchemaUri(); final String metadataBlob = md.getMetadata(); if (!isEmptyOrNull(metadataBlob)) { if (!isEmptyOrNull(schemaUri)) { writer.addAttribute(A_SCHEMA, schemaUri); } try { final DcsStaxWriter staxWriter = (DcsStaxWriter) writer.underlyingWriter(); log.trace("Copying metadata blob: \n{}", metadataBlob); staxWriter.copyNode(metadataBlob, staxWriter.getXMLStreamWriter()); } catch (XMLStreamException e) { throw new ConversionException(e.getMessage(), e); } } } else if (source instanceof DcsMetadataRef) { final DcsMetadataRef mdRef = (DcsMetadataRef) source; final String ref = mdRef.getRef(); if (!isEmptyOrNull(ref)) { writer.addAttribute(A_REF, ref); } } else { log.warn("Unable to marshal metadata source object {} of type {}", source, source.getClass().getName()); } }
@Override public HierarchicalStreamWriter createWriter(Writer out) { try { outFactory.setProperty("javax.xml.stream.isRepairingNamespaces", true); return new DcsStaxWriter(qnames, outFactory.createXMLStreamWriter(out), false, true); } catch (XMLStreamException e) { log.error(e.getMessage(), e); } return null; }
final DcsStaxWriter staxWriter = (DcsStaxWriter) writer.underlyingWriter(); log.trace("Copying metadata blob: \n{}", metadataBlob); staxWriter.copyNode(metadataBlob, staxWriter.getXMLStreamWriter());
@Override public HierarchicalStreamWriter createWriter(Writer out) { try { outFactory.setProperty("javax.xml.stream.isRepairingNamespaces", true); return new DcsStaxWriter(qnames, outFactory.createXMLStreamWriter(out), false, true); } catch (XMLStreamException e) { log.error(e.getMessage(), e); } return null; }