gpt4 book ai didi

org.eclipse.persistence.oxm.XMLMarshaller.objectToXML()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-20 01:59:40 27 4
gpt4 key购买 nike

本文整理了Java中org.eclipse.persistence.oxm.XMLMarshaller.objectToXML()方法的一些代码示例,展示了XMLMarshaller.objectToXML()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLMarshaller.objectToXML()方法的具体详情如下:
包路径:org.eclipse.persistence.oxm.XMLMarshaller
类名称:XMLMarshaller
方法名:objectToXML

XMLMarshaller.objectToXML介绍

[英]PUBLIC: Convert the given object to an XML Document
[中]PUBLIC:将给定对象转换为XML文档

代码示例

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * 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);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * 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);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
* 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);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
* 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);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
* 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);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
* 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);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
* 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);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

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);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
 * 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());
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
 * 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());
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
 * 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());
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

@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);
}

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

/**
* 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);
}

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

/**
* 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);
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

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();
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

/**
* 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();
}

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

domRecord.setDocPresPolicy(getDocumentPreservationPolicy());
Node n = this.marshaller.objectToXML(obj, node, desc, domRecord, isXMLRoot, this.getDocumentPreservationPolicy());

代码示例来源:origin: com.haulmont.thirdparty/eclipselink

domRecord.setDocPresPolicy(getDocumentPreservationPolicy());
Node n = this.marshaller.objectToXML(obj, node, desc, domRecord, isXMLRoot, this.getDocumentPreservationPolicy());

代码示例来源:origin: org.eclipse.persistence/org.eclipse.persistence.core

domRecord.setDocPresPolicy(getDocumentPreservationPolicy());
Node n = this.marshaller.objectToXML(obj, node, desc, domRecord, isXMLRoot, this.getDocumentPreservationPolicy());

代码示例来源:origin: org.eclipse.persistence/com.springsource.org.eclipse.persistence

xmlRow.setXOPPackage(getAttachmentMarshaller().isXOPPackage());
return objectToXML(object, descriptor, xmlRow, isXMLRoot, docPresPolicy);

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com