/** * Saves the DataObject as an XML document with the specified root element. * Same as * save(createDocument(dataObject, rootElementURI, rootElementName), * outputStream, null); * * @param dataObject specifies DataObject to be saved * @param rootElementURI the Target Namespace URI of the root XML element * @param rootElementName the Name of the root XML element * @param outputStream specifies the OutputStream to write to. * @throws IOException for stream exceptions. * @throws IllegalArgumentException if the dataObject tree * is not closed or has no container. */ public void save(DataObject dataObject, String rootElementURI, String rootElementName, OutputStream outputStream) throws XMLMarshalException, IOException { XMLMarshaller xmlMarshaller = getXmlMarshaller(null); OutputStreamWriter writer = new OutputStreamWriter(outputStream, xmlMarshaller.getEncoding()); save(dataObject, rootElementURI, rootElementName, writer, xmlMarshaller); }
/** * Saves the DataObject as an XML document with the specified root element. * Same as * save(createDocument(dataObject, rootElementURI, rootElementName), * outputStream, null); * * @param dataObject specifies DataObject to be saved * @param rootElementURI the Target Namespace URI of the root XML element * @param rootElementName the Name of the root XML element * @param outputStream specifies the OutputStream to write to. * @throws IOException for stream exceptions. * @throws IllegalArgumentException if the dataObject tree * is not closed or has no container. */ public void save(DataObject dataObject, String rootElementURI, String rootElementName, OutputStream outputStream) throws XMLMarshalException, IOException { XMLMarshaller xmlMarshaller = getXmlMarshaller(null); OutputStreamWriter writer = new OutputStreamWriter(outputStream, xmlMarshaller.getEncoding()); save(dataObject, rootElementURI, rootElementName, writer, xmlMarshaller); }
public void serialize(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException { XMLMarshaller xmlMarshaller = getXmlMarshaller(); XMLAttachmentMarshaller attachmentMarshaller = xmlMarshaller.getAttachmentMarshaller(); //temporarily null out the attachment marshaller as it should not be used during serialization xmlMarshaller.setAttachmentMarshaller(null); OutputStreamWriter writer = new OutputStreamWriter(outputStream, xmlMarshaller.getEncoding()); save(xmlDocument, writer, xmlMarshaller); xmlMarshaller.setAttachmentMarshaller(attachmentMarshaller); }
public void serialize(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException { XMLMarshaller xmlMarshaller = getXmlMarshaller(); XMLAttachmentMarshaller attachmentMarshaller = xmlMarshaller.getAttachmentMarshaller(); //temporarily null out the attachment marshaller as it should not be used during serialization xmlMarshaller.setAttachmentMarshaller(null); OutputStreamWriter writer = new OutputStreamWriter(outputStream, xmlMarshaller.getEncoding()); save(xmlDocument, writer, xmlMarshaller); xmlMarshaller.setAttachmentMarshaller(attachmentMarshaller); }
/** * Serializes an XMLDocument as an XML document into the outputStream. * If the DataObject's Type was defined by an XSD, the serialization * will follow the XSD. * Otherwise the serialization will follow the format as if an XSD * were generated as defined by the SDO specification. * The OutputStream will be flushed after writing. * Does not perform validation to ensure compliance with an XSD. * @param xmlDocument specifies XMLDocument to be saved * @param outputStream specifies the OutputStream to write to. * @param options implementation-specific options. * @throws IOException for stream exceptions. * @throws IllegalArgumentException if the dataObject tree * is not closed or has no container. */ public void save(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException { if (xmlDocument == null) { throw new IllegalArgumentException(SDOException.cannotPerformOperationWithNullInputParameter("save", "xmlDocument")); } XMLMarshaller xmlMarshaller = getXmlMarshaller(options); String encoding = xmlMarshaller.getEncoding(); if(xmlDocument.getEncoding() != null) { encoding = xmlDocument.getEncoding(); } OutputStreamWriter writer = new OutputStreamWriter(outputStream, encoding); save(xmlDocument, writer, xmlMarshaller); }
public Object getProperty(String propName) throws PropertyException { if (null == propName) { throw new IllegalArgumentException(); } if (propName.equals(Marshaller.JAXB_ENCODING)) { return this.xmlBinder.getMarshaller().getEncoding(); } if (propName.equals(Marshaller.JAXB_FORMATTED_OUTPUT)) { return this.xmlBinder.getMarshaller().isFormattedOutput(); } if (propName.equals(Marshaller.JAXB_FRAGMENT)) { return this.xmlBinder.getMarshaller().isFragment(); } if (propName.equals(Marshaller.JAXB_SCHEMA_LOCATION)) { return this.xmlBinder.getMarshaller().getSchemaLocation(); } if (propName.equals(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION)) { return this.xmlBinder.getMarshaller().getNoNamespaceSchemaLocation(); } throw new PropertyException(propName); }
@Override public Object getProperty(String propName) throws PropertyException { if (null == propName) { throw new IllegalArgumentException(); } if (propName.equals(Marshaller.JAXB_ENCODING)) { return this.xmlBinder.getMarshaller().getEncoding(); } if (propName.equals(Marshaller.JAXB_FORMATTED_OUTPUT)) { return this.xmlBinder.getMarshaller().isFormattedOutput(); } if (propName.equals(Marshaller.JAXB_FRAGMENT)) { return this.xmlBinder.getMarshaller().isFragment(); } if (propName.equals(Marshaller.JAXB_SCHEMA_LOCATION)) { return this.xmlBinder.getMarshaller().getSchemaLocation(); } if (propName.equals(Marshaller.JAXB_NO_NAMESPACE_SCHEMA_LOCATION)) { return this.xmlBinder.getMarshaller().getNoNamespaceSchemaLocation(); } throw new PropertyException(propName); }
/** * Serializes an XMLDocument as an XML document into the outputStream. * If the DataObject's Type was defined by an XSD, the serialization * will follow the XSD. * Otherwise the serialization will follow the format as if an XSD * were generated as defined by the SDO specification. * The OutputStream will be flushed after writing. * Does not perform validation to ensure compliance with an XSD. * @param xmlDocument specifies XMLDocument to be saved * @param outputStream specifies the OutputStream to write to. * @param options implementation-specific options. * @throws IOException for stream exceptions. * @throws IllegalArgumentException if the dataObject tree * is not closed or has no container. */ public void save(XMLDocument xmlDocument, OutputStream outputStream, Object options) throws IOException { if (xmlDocument == null) { throw new IllegalArgumentException(SDOException.cannotPerformOperationWithNullInputParameter("save", "xmlDocument")); } XMLMarshaller xmlMarshaller = getXmlMarshaller(options); String encoding = xmlMarshaller.getEncoding(); if(xmlDocument.getEncoding() != null) { encoding = xmlDocument.getEncoding(); } OutputStreamWriter writer = new OutputStreamWriter(outputStream, encoding); save(xmlDocument, writer, xmlMarshaller); }
return xmlMarshaller.isFormattedOutput(); } else if (JAXB_ENCODING.equals(key)) { return xmlMarshaller.getEncoding(); } else if (JAXB_SCHEMA_LOCATION.equals(key)) { return xmlMarshaller.getSchemaLocation();
return xmlMarshaller.isFormattedOutput(); } else if (JAXB_ENCODING.equals(key)) { return xmlMarshaller.getEncoding(); } else if (JAXB_SCHEMA_LOCATION.equals(key)) { return xmlMarshaller.getSchemaLocation();
boolean isXMLRoot = false; String version = DEFAULT_XML_VERSION; String encoding = getEncoding(); if (object instanceof XMLRoot) { isXMLRoot = true;
String encoding = getEncoding(); if (object instanceof XMLRoot) { isXMLRoot = true;
String encoding = getEncoding(); String version = DEFAULT_XML_VERSION; if (!isXMLRoot) {