/** * INTERNAL: * Convert the given object to an XML Document */ public Document objectToXML(Object object, XMLDescriptor descriptor, XMLRecord xmlRow, boolean isXMLRoot, DocumentPreservationPolicy docPresPolicy) { return objectToXML(object, null, descriptor, xmlRow, isXMLRoot, docPresPolicy); }
/** * INTERNAL: * Convert the given object to an XML Document */ public Document objectToXML(Object object, XMLDescriptor descriptor, XMLRecord xmlRow, boolean isXMLRoot, DocumentPreservationPolicy docPresPolicy) { return objectToXML(object, null, descriptor, xmlRow, isXMLRoot, docPresPolicy); }
/** * PUBLIC: * Convert the given object to descendants of the parent element * @param object the object to marshal * @param parent the node to marshal the object to * @return the document which the specified object has been marshalled to * @throws XMLMarshalException if an error occurred during marshalling * @deprecated */ public Document objectToXML(Object object, Node parent) throws XMLMarshalException { return objectToXML(object, parent, null); }
/** * PUBLIC: * Convert the given object to descendants of the parent element * @param object the object to marshal * @param parent the node to marshal the object to * @return the document which the specified object has been marshalled to * @throws XMLMarshalException if an error occurred during marshalling * @deprecated */ public Document objectToXML(Object object, Node parent) throws XMLMarshalException { return objectToXML(object, parent, null); }
/** * INTERNAL: * Convert the given object to an XML Document */ public Document objectToXML(Object object, XMLDescriptor descriptor, XMLRecord xmlRow, boolean isXMLRoot, DocumentPreservationPolicy docPresPolicy) { return objectToXML(object, null, descriptor, xmlRow, isXMLRoot, docPresPolicy); }
/** * PUBLIC: * Convert the given object to descendants of the parent element * @param object the object to marshal * @param parent the node to marshal the object to * @return the document which the specified object has been marshalled to * @throws XMLMarshalException if an error occurred during marshalling * @deprecated */ @Deprecated public Document objectToXML(Object object, Node parent) throws XMLMarshalException { return objectToXML(object, parent, null); }
/** * PUBLIC: * Convert the given object to an XML Document * @param object the object to marshal * @return the document which the specified object has been marshalled to * @throws XMLMarshalException if an error occurred during marshalling */ public Document objectToXML(Object object) throws XMLMarshalException { boolean isXMLRoot = (object instanceof XMLRoot); XMLDescriptor xmlDescriptor = getDescriptor(object, isXMLRoot); return objectToXML(object, xmlDescriptor, isXMLRoot); }
protected Node objectToXMLNode(Object object, Node rootNode, AbstractSession session,XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException { DocumentPreservationPolicy docPresPolicy = context.getDocumentPreservationPolicy(session); if (docPresPolicy != null && docPresPolicy.shouldPreserveDocument()) { XMLRecord xmlRow = null; if (!isXMLRoot) { xmlRow = (XMLRecord) ((XMLObjectBuilder) descriptor.getObjectBuilder()).createRecordFor(object, context.getDocumentPreservationPolicy(session)); xmlRow.setMarshaller(this); if (this.attachmentMarshaller != null) { xmlRow.setXOPPackage(this.attachmentMarshaller.isXOPPackage()); } if (xmlRow.getDOM().getNodeType() == Node.ELEMENT_NODE) { addDescriptorNamespacesToXMLRecord(descriptor, xmlRow); } } Document doc = objectToXML(object, rootNode, descriptor, xmlRow, isXMLRoot, docPresPolicy); if ((xmlRow != null) && (xmlRow.getDOM().getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) { return xmlRow.getDOM(); } else { return doc; } } return super.objectToXMLNode(object, rootNode, session, descriptor, isXMLRoot); }
/** * Validate the given root object. * @param rootObject A single root object to validate * @return true if this is a valid object, otherwise false */ public boolean validateRoot(Object rootObject) throws XMLMarshalException { if (rootObject == null) { throw XMLMarshalException.nullArgumentException(); } XMLDescriptor xmlDescriptor = (XMLDescriptor)xmlContext.getSession(rootObject).getDescriptor(rootObject); Document document = marshaller.objectToXML(rootObject, xmlDescriptor, false); if (xmlDescriptor.getSchemaReference() == null) { throw XMLMarshalException.schemaReferenceNotSet(xmlDescriptor); } return xmlDescriptor.getSchemaReference().isValid(document, getErrorHandler()); }
/** * Validate the given root object. * @param rootObject A single root object to validate * @return true if this is a valid object, otherwise false */ public boolean validateRoot(Object rootObject) throws XMLMarshalException { if (rootObject == null) { throw XMLMarshalException.nullArgumentException(); } XMLDescriptor xmlDescriptor = (XMLDescriptor)xmlContext.getSession(rootObject).getDescriptor(rootObject); Document document = marshaller.objectToXML(rootObject, xmlDescriptor, false); if (xmlDescriptor.getSchemaReference() == null) { throw XMLMarshalException.schemaReferenceNotSet(xmlDescriptor); } return xmlDescriptor.getSchemaReference().isValid(document, getErrorHandler()); }
/** * Validate the given root object. * @param rootObject A single root object to validate * @return true if this is a valid object, otherwise false */ public boolean validateRoot(Object rootObject) throws XMLMarshalException { if (rootObject == null) { throw XMLMarshalException.nullArgumentException(); } XMLDescriptor xmlDescriptor = (XMLDescriptor)xmlContext.getSession(rootObject).getDescriptor(rootObject); Document document = marshaller.objectToXML(rootObject, xmlDescriptor, false); if (xmlDescriptor.getSchemaReference() == null) { throw XMLMarshalException.schemaReferenceNotSet(xmlDescriptor); } return xmlDescriptor.getSchemaReference().isValid(document, getErrorHandler()); }
@Override protected Node objectToXMLNode(Object object, Node rootNode, AbstractSession session,XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException { DocumentPreservationPolicy docPresPolicy = context.getDocumentPreservationPolicy(session); if (docPresPolicy != null && docPresPolicy.shouldPreserveDocument()) { XMLRecord xmlRow = null; if (!isXMLRoot) { xmlRow = (XMLRecord) ((XMLObjectBuilder) descriptor.getObjectBuilder()).createRecordFor(object, context.getDocumentPreservationPolicy(session)); xmlRow.setMarshaller(this); if (this.attachmentMarshaller != null) { xmlRow.setXOPPackage(this.attachmentMarshaller.isXOPPackage()); } if (xmlRow.getDOM().getNodeType() == Node.ELEMENT_NODE) { addDescriptorNamespacesToXMLRecord(descriptor, xmlRow); } } Document doc = objectToXML(object, rootNode, descriptor, xmlRow, isXMLRoot, docPresPolicy); if ((xmlRow != null) && (xmlRow.getDOM().getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) { return xmlRow.getDOM(); } else { return doc; } } return super.objectToXMLNode(object, rootNode, session, descriptor, isXMLRoot); }
/** * INTERNAL: * Convert the given object to an XML Document * @param object the object to marshal * @return the document which the specified object has been marshalled to * @param descriptor the XMLDescriptor for the object being marshalled * @throws XMLMarshalException if an error occurred during marshalling */ @Override protected Document objectToXML(Object object, XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException { AbstractSession session = context.getSession(descriptor); DocumentPreservationPolicy docPresPolicy = context.getDocumentPreservationPolicy(session); if (docPresPolicy != null && docPresPolicy.shouldPreserveDocument()) { XMLRecord xmlRow = null; if (!isXMLRoot) { xmlRow = (XMLRecord) ((XMLObjectBuilder) descriptor.getObjectBuilder()).createRecordFor(object, context.getDocumentPreservationPolicy(session)); xmlRow.setMarshaller(this); if (this.attachmentMarshaller != null) { xmlRow.setXOPPackage(this.attachmentMarshaller.isXOPPackage()); } addDescriptorNamespacesToXMLRecord(descriptor, xmlRow); } return objectToXML(object, descriptor, xmlRow, isXMLRoot, docPresPolicy); } return super.objectToXML(object, descriptor, isXMLRoot); }
/** * INTERNAL: * Convert the given object to an XML Document * @param object the object to marshal * @return the document which the specified object has been marshalled to * @param descriptor the XMLDescriptor for the object being marshalled * @throws XMLMarshalException if an error occurred during marshalling */ protected Document objectToXML(Object object, XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException { AbstractSession session = context.getSession(descriptor); DocumentPreservationPolicy docPresPolicy = context.getDocumentPreservationPolicy(session); if (docPresPolicy != null && docPresPolicy.shouldPreserveDocument()) { XMLRecord xmlRow = null; if (!isXMLRoot) { xmlRow = (XMLRecord) ((XMLObjectBuilder) descriptor.getObjectBuilder()).createRecordFor(object, context.getDocumentPreservationPolicy(session)); xmlRow.setMarshaller(this); if (this.attachmentMarshaller != null) { xmlRow.setXOPPackage(this.attachmentMarshaller.isXOPPackage()); } addDescriptorNamespacesToXMLRecord(descriptor, xmlRow); } return objectToXML(object, descriptor, xmlRow, isXMLRoot, docPresPolicy); } return super.objectToXML(object, descriptor, isXMLRoot); }
protected Node objectToXMLNode(Object object, Node rootNode, AbstractSession session,XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException { DocumentPreservationPolicy docPresPolicy = xmlContext.getDocumentPreservationPolicy(session); if (docPresPolicy != null && docPresPolicy.shouldPreserveDocument()) { XMLRecord xmlRow = null; if (!isXMLRoot) { xmlRow = (XMLRecord) ((XMLObjectBuilder) descriptor.getObjectBuilder()).createRecordFor(object, xmlContext.getDocumentPreservationPolicy(session)); xmlRow.setMarshaller(this); if (getAttachmentMarshaller() != null) { xmlRow.setXOPPackage(getAttachmentMarshaller().isXOPPackage()); } if (xmlRow.getDOM().getNodeType() == Node.ELEMENT_NODE) { addDescriptorNamespacesToXMLRecord(descriptor, xmlRow); } } Document doc = objectToXML(object, rootNode, descriptor, xmlRow, isXMLRoot, docPresPolicy); if ((xmlRow != null) && (xmlRow.getDOM().getNodeType() == Node.DOCUMENT_FRAGMENT_NODE)) { return xmlRow.getDOM(); } else { return doc; } } MarshalRecord marshalRecord = new NodeRecord(); marshalRecord.setMarshaller(this); marshalRecord.getNamespaceResolver().setDOM(rootNode); marshal(object, marshalRecord, session, descriptor, isXMLRoot); return marshalRecord.getDocument(); }
/** * INTERNAL: * Convert the given object to an XML Document * @param object the object to marshal * @return the document which the specified object has been marshalled to * @param descriptor the XMLDescriptor for the object being marshalled * @throws XMLMarshalException if an error occurred during marshalling */ protected Document objectToXML(Object object, XMLDescriptor descriptor, boolean isXMLRoot) throws XMLMarshalException { AbstractSession session = xmlContext.getSession(descriptor); DocumentPreservationPolicy docPresPolicy = xmlContext.getDocumentPreservationPolicy(session); if (docPresPolicy != null && docPresPolicy.shouldPreserveDocument()) { XMLRecord xmlRow = null; if (!isXMLRoot) { xmlRow = (XMLRecord) ((XMLObjectBuilder) descriptor.getObjectBuilder()).createRecordFor(object, xmlContext.getDocumentPreservationPolicy(session)); xmlRow.setMarshaller(this); if (getAttachmentMarshaller() != null) { xmlRow.setXOPPackage(getAttachmentMarshaller().isXOPPackage()); } addDescriptorNamespacesToXMLRecord(descriptor, xmlRow); } return objectToXML(object, descriptor, xmlRow, isXMLRoot, docPresPolicy); } MarshalRecord marshalRecord = new NodeRecord(); marshalRecord.setMarshaller(this); marshal(object, marshalRecord, session, descriptor, isXMLRoot); return marshalRecord.getDocument(); }
domRecord.setDocPresPolicy(getDocumentPreservationPolicy()); Node n = this.marshaller.objectToXML(obj, node, desc, domRecord, isXMLRoot, this.getDocumentPreservationPolicy());
domRecord.setDocPresPolicy(getDocumentPreservationPolicy()); Node n = this.marshaller.objectToXML(obj, node, desc, domRecord, isXMLRoot, this.getDocumentPreservationPolicy());
domRecord.setDocPresPolicy(getDocumentPreservationPolicy()); Node n = this.marshaller.objectToXML(obj, node, desc, domRecord, isXMLRoot, this.getDocumentPreservationPolicy());
xmlRow.setXOPPackage(getAttachmentMarshaller().isXOPPackage()); return objectToXML(object, descriptor, xmlRow, isXMLRoot, docPresPolicy);