Search in sources :

Example 16 with XMLRoot

use of org.eclipse.persistence.oxm.XMLRoot in project eclipselink by eclipse-ee4j.

the class SDOMarshalListener method doMarshal.

private // 
void doMarshal(// 
SDOProperty prop, // 
DataObject value, // 
SDOChangeSummary cs, Element csNode, SDODataObject modifiedObject, List deletedXPaths, String xpathToCS, String sdoPrefix, String rootElementName) {
    if (value == null) {
        // Marshal out xsi:nil=true
        DOMRecord row = new DOMRecord(csNode);
        Session session = ((SDOXMLHelper) typeHelper.getHelperContext().getXMLHelper()).getXmlContext().getSession();
        row.setSession((AbstractSession) session);
        marshalNilAttribute(prop, row);
        return;
    }
    boolean isDeleted = false;
    // Do we need a second map or can we just check the values of the deleted map
    Object original = cs.getReverseDeletedMap().get(value);
    if ((original != null) && cs.isDeleted((DataObject) original)) {
        isDeleted = true;
    }
    String qualifiedName = getXPathForProperty(prop);
    String uri = null;
    if (prop.isOpenContent()) {
        uri = prop.getUri();
    } else {
        uri = ((XMLField) prop.getXmlMapping().getField()).getXPathFragment().getNamespaceURI();
    }
    if (isDeleted) {
        String pathToNode = getPathFromAncestor(((SDODataObject) original), modifiedObject, cs);
        String containerPath = null;
        containerPath = getQualifiedName(modifiedObject);
        deletedXPaths.add(xpathToCS + containerPath + SDOConstants.SDO_XPATH_SEPARATOR_FRAGMENT + pathToNode);
        XMLRoot xmlroot = new XMLRoot();
        // set the object to the deep copy
        xmlroot.setObject(value);
        xmlroot.setNamespaceURI(uri);
        xmlroot.setLocalName(qualifiedName);
        xmlMarshaller.marshal(xmlroot, csNode);
    } else {
        // need sdoref
        Element modifiedElement = null;
        if (uri == null) {
            modifiedElement = csNode.getOwnerDocument().createElement(qualifiedName);
        } else {
            modifiedElement = csNode.getOwnerDocument().createElementNS(uri, qualifiedName);
        }
        csNode.appendChild(modifiedElement);
        String nextPath = getPathFromAncestor((SDODataObject) original, (SDODataObject) marshalledObject, cs);
        // Add sdoRef attribute...all modified objects written should have this
        if (nextPath == SDOConstants.EMPTY_STRING) {
            // if this is the root, just put the root element
            modifiedElement.setAttributeNS(SDOConstants.SDO_URL, // 
            sdoPrefix + // 
            SDOConstants.SDO_XPATH_NS_SEPARATOR_FRAGMENT + // 
            SDOConstants.CHANGESUMMARY_REF, SDOConstants.SDO_CHANGESUMMARY_REF_PATH_PREFIX + // 
            SDOConstants.SDO_XPATH_SEPARATOR_FRAGMENT + rootElementName);
        } else {
            modifiedElement.setAttributeNS(SDOConstants.SDO_URL, // 
            sdoPrefix + // 
            SDOConstants.SDO_XPATH_NS_SEPARATOR_FRAGMENT + // 
            SDOConstants.CHANGESUMMARY_REF, SDOConstants.SDO_CHANGESUMMARY_REF_PATH_PREFIX + // 
            SDOConstants.SDO_XPATH_SEPARATOR_FRAGMENT + rootElementName + "/" + nextPath);
        }
        // Added for bug 6346754
        if ((((SDODataObject) original).getContainmentProperty() != null) && ((SDODataObject) original).getContainmentProperty().getType().isDataObjectType()) {
            // may also need xsi:type
            String schemaContext = ((SDOType) value.getType()).getXmlDescriptor().getSchemaReference().getSchemaContext();
            QName schemaContextQName = ((SDOType) value.getType()).getXmlDescriptor().getSchemaReference().getSchemaContextAsQName(((SDOType) value.getType()).getXmlDescriptor().getNonNullNamespaceResolver());
            if (schemaContext != null) {
                String typeValue = schemaContext.substring(1, schemaContext.length());
                String schemaInstancePrefix = ((SDOType) value.getType()).getXmlDescriptor().getNonNullNamespaceResolver().resolveNamespaceURI(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
                // may or may not need the xmlns declaration added.
                String schemaContextUri = schemaContextQName.getNamespaceURI();
                String schemaContextPrefix = ((SDOType) value.getType()).getXmlDescriptor().getNonNullNamespaceResolver().resolveNamespaceURI(schemaContextUri);
                if (schemaContextPrefix != null) {
                    modifiedElement.setAttributeNS(javax.xml.XMLConstants.XMLNS_ATTRIBUTE_NS_URI, javax.xml.XMLConstants.XMLNS_ATTRIBUTE + XMLConstants.COLON + schemaContextPrefix, schemaContextQName.getNamespaceURI());
                }
                modifiedElement.setAttributeNS(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, schemaInstancePrefix + XMLConstants.COLON + XMLConstants.SCHEMA_TYPE_ATTRIBUTE, typeValue);
            }
        }
    }
}
Also used : XMLField(org.eclipse.persistence.oxm.XMLField) SDODataObject(org.eclipse.persistence.sdo.SDODataObject) DataObject(commonj.sdo.DataObject) DOMRecord(org.eclipse.persistence.oxm.record.DOMRecord) XMLRoot(org.eclipse.persistence.oxm.XMLRoot) QName(javax.xml.namespace.QName) Element(org.w3c.dom.Element) SDOType(org.eclipse.persistence.sdo.SDOType) SDODataObject(org.eclipse.persistence.sdo.SDODataObject) DataObject(commonj.sdo.DataObject) AbstractSession(org.eclipse.persistence.internal.sessions.AbstractSession) Session(org.eclipse.persistence.sessions.Session) SDODataObject(org.eclipse.persistence.sdo.SDODataObject)

Example 17 with XMLRoot

use of org.eclipse.persistence.oxm.XMLRoot in project eclipselink by eclipse-ee4j.

the class SDOEqualityHelper method compareSequences.

/**
 * INTERNAL: Return whether the 2 sequences are equal.
 * Element properties and unstructured text will be compared - attributes are out of scope.
 * <p>
 * For shallow equal - only dataType=true objects are compared, DataObject values are ignored but should be defaults.
 * Note: A setting object should handle its own isEqual() behavior
 *
 * @param aSequence
 * @param aSequenceCopy
 * @param isDeep
 * @return
 */
private boolean compareSequences(SDOSequence aSequence, SDOSequence aSequenceCopy, boolean isDeep) {
    // corner case: isSequenced set to true after type definition had not sequence
    if ((null == aSequence) && (null == aSequenceCopy)) {
        return true;
    }
    // both sequences must be null
    if ((null == aSequence) || (null == aSequenceCopy)) {
        return false;
    }
    // for shallow equal - match whether we skipped creating settings or set value=null for shallow copies
    if (isDeep && aSequence.size() != aSequenceCopy.size()) {
        return false;
    }
    // the settings inside the sequence must be new objects
    List<Setting> originalSettingsList = aSequence.getSettings();
    List<Setting> copySettingsList = aSequenceCopy.getSettings();
    if ((null == originalSettingsList) || (null == copySettingsList)) {
        return false;
    }
    SDOProperty originalProperty = null;
    SDOProperty copyProperty = null;
    /**
     * For shallow equal when dataType is false we do not check this setting,
     * the value will be unset (default value) in the shallow copy.
     * orig                  v1=String  v2=DataObject   v3=String
     * shallowcopy  v1=String  v2=null(default)  v3=String
     * deepcopy       v1=String  v2=DataObject    v3=String
     */
    if (isDeep) {
        for (int index = 0, size = aSequence.size(); index < size; index++) {
            originalProperty = aSequence.getProperty(originalSettingsList.get(index));
            copyProperty = aSequenceCopy.getProperty(copySettingsList.get(index));
            // both !null = valid state (check equality)
            if (((null == originalProperty) && (null != copyProperty)) || ((null != originalProperty) && (null == copyProperty))) {
                return false;
            }
            // the property field on the setting must point to the same property instance as the original
            if (!arePropertiesEqual(originalProperty, copyProperty)) {
                // handle both properties == null
                return false;
            }
            Object originalValue = aSequence.getValue(index);
            Object copyValue = aSequenceCopy.getValue(index);
            // for unstructuredText (null property) and simple dataTypes we check equality directly
            if ((null == originalProperty) || originalProperty.getType().isDataType()) {
                // if one of the values is null return false
                if (// 
                ((null == originalValue) && (null != copyValue)) || ((null != originalValue) && (null == copyValue))) {
                    return false;
                }
                // if both values are null - they are equal
                if ((null != originalValue) && !originalValue.equals(copyValue)) {
                    // we can also use !.equals()
                    return false;
                }
            } else {
                // only compare DataObjects when in a  deep equal
                if (isDeep) {
                    if ((null != originalValue) && (null != copyValue)) {
                        // the values may not match their types - return false instead of a CCE
                        if (originalValue instanceof DataObject && copyValue instanceof DataObject) {
                            if (!equal((DataObject) originalValue, (DataObject) copyValue)) {
                                return false;
                            }
                        } else if (originalValue instanceof XMLRoot && copyValue instanceof XMLRoot) {
                            XMLRoot originalXMLRoot = (XMLRoot) originalValue;
                            XMLRoot copyXMLRoot = (XMLRoot) copyValue;
                            // compare local names of XMLRoot objects
                            if (!originalXMLRoot.getLocalName().equals(copyXMLRoot.getLocalName())) {
                                return false;
                            }
                            // compare uris of XMLRoot objects
                            if (!originalXMLRoot.getNamespaceURI().equals(copyXMLRoot.getNamespaceURI())) {
                                return false;
                            }
                            Object originalUnwrappedValue = (originalXMLRoot).getObject();
                            Object copyUnwrappedValue = (copyXMLRoot).getObject();
                            if (originalUnwrappedValue instanceof DataObject && copyUnwrappedValue instanceof DataObject) {
                                if (!equal((DataObject) originalUnwrappedValue, (DataObject) copyUnwrappedValue)) {
                                    return false;
                                }
                            }
                        } else {
                            return false;
                        }
                    } else {
                        // both values must be null to be equal
                        if (((null == originalValue) && (null != copyValue)) || ((null == copyValue) && (null != originalValue))) {
                            return false;
                        }
                    }
                } else {
                // For DataObjects in general anything that is deep equal is also shallow equal - but not the reverse.
                // In the case of shallow equal on sequences.  We can ignore the state of the 2 complex objects.
                // UC1: if aSequenceCopy setting was from a shallowCopy then it will be unset.
                // UC2: if aSequenceCopy setting was from a deepCopy or a reversed argument shallowCopy then it may be unset or set.
                // We will not check for a default value on either sequence setting.
                }
            }
        }
    } else {
        int cpyIdx = 0;
        boolean locatedSetting;
        // compare settings
        for (int idx = 0; idx < aSequence.getSettings().size(); idx++) {
            SDOProperty nextProperty = aSequence.getProperty(idx);
            if (nextProperty == null || nextProperty.getType().isDataType()) {
                // compare to the next copy datatype setting
                Object nextValue = aSequence.getValue(idx);
                locatedSetting = false;
                for (; cpyIdx < aSequenceCopy.getSettings().size(); cpyIdx++) {
                    SDOProperty nextCopyProperty = aSequenceCopy.getProperty(cpyIdx);
                    if (nextCopyProperty == null || nextCopyProperty.getType().isDataType()) {
                        // at this point we need to compare the two Settings and their properties
                        Object nextCopyValue = aSequenceCopy.getValue(cpyIdx);
                        if (nextValue == nextCopyValue && arePropertiesEqual(nextProperty, nextCopyProperty)) {
                            locatedSetting = true;
                        }
                        cpyIdx++;
                        break;
                    }
                }
                if (!locatedSetting) {
                    return false;
                }
            }
        }
        // at this point there should not be any more copy settings
        if (getIndexOfNextDataTypeSetting(aSequenceCopy, cpyIdx) != -1) {
            return false;
        }
    }
    return true;
}
Also used : DataObject(commonj.sdo.DataObject) SDODataObject(org.eclipse.persistence.sdo.SDODataObject) XMLRoot(org.eclipse.persistence.oxm.XMLRoot) Setting(org.eclipse.persistence.oxm.sequenced.Setting) DataObject(commonj.sdo.DataObject) SDODataObject(org.eclipse.persistence.sdo.SDODataObject) SDOProperty(org.eclipse.persistence.sdo.SDOProperty)

Example 18 with XMLRoot

use of org.eclipse.persistence.oxm.XMLRoot in project eclipselink by eclipse-ee4j.

the class SDOFragmentMappingAttributeAccessor method setAttributeValueInObject.

/**
 * Sets the value of the instance variable in the object to the value.
 */
@Override
public void setAttributeValueInObject(Object domainObject, Object attributeValue) throws DescriptorException {
    XMLUnmarshaller unmarshaller = ((SDOXMLHelper) helperContext.getXMLHelper()).getXmlContext().createUnmarshaller();
    unmarshaller.setUnmarshalListener(new org.eclipse.persistence.sdo.helper.SDOCSUnmarshalListener(helperContext));
    if (attributeValue instanceof Collection) {
        // handle collection case
        ArrayList result = new ArrayList();
        Iterator fragments = ((Collection) attributeValue).iterator();
        while (fragments.hasNext()) {
            Node next = (Node) fragments.next();
            // Handle Simple Case here
            Object dataObject = unmarshaller.unmarshal(next);
            if (dataObject instanceof org.eclipse.persistence.oxm.XMLRoot) {
                dataObject = ((XMLRoot) dataObject).getObject();
            }
            result.add(dataObject);
        }
        ((SDODataObject) domainObject).set(property, result);
    } else {
        Object result = null;
        if (!(attributeValue == null)) {
            Node value = (Node) attributeValue;
            result = unmarshaller.unmarshal(value);
            if (result instanceof org.eclipse.persistence.oxm.XMLRoot) {
                result = ((XMLRoot) result).getObject();
            }
        }
        ((SDODataObject) domainObject).set(property, result);
    }
}
Also used : XMLRoot(org.eclipse.persistence.oxm.XMLRoot) Node(org.w3c.dom.Node) ArrayList(java.util.ArrayList) Iterator(java.util.Iterator) Collection(java.util.Collection) SDODataObject(org.eclipse.persistence.sdo.SDODataObject) XMLUnmarshaller(org.eclipse.persistence.oxm.XMLUnmarshaller) SDODataObject(org.eclipse.persistence.sdo.SDODataObject)

Example 19 with XMLRoot

use of org.eclipse.persistence.oxm.XMLRoot in project eclipselink by eclipse-ee4j.

the class DOMUnmarshaller method xmlToObject.

/**
 * INTERNAL: Convert the Oracle XMLDocument to the reference-class.
 */
public Object xmlToObject(DOMRecord xmlRow, Class<?> referenceClass) throws XMLMarshalException {
    try {
        // Try to get the Encoding and Version from DOM3 APIs if available
        String xmlEncoding = "UTF-8";
        String xmlVersion = "1.0";
        try {
            xmlEncoding = xmlRow.getDocument().getXmlEncoding() != null ? xmlRow.getDocument().getXmlEncoding() : xmlEncoding;
            xmlVersion = xmlRow.getDocument().getXmlVersion() != null ? xmlRow.getDocument().getXmlVersion() : xmlVersion;
        } catch (Exception ex) {
        // if the methods aren't available, then just use the default values
        }
        XMLContext xmlContext = xmlUnmarshaller.getXMLContext();
        // populate and return an XMLRoot
        if (referenceClass != null && (XMLConversionManager.getDefaultJavaTypes().get(referenceClass) != null || CoreClassConstants.XML_GREGORIAN_CALENDAR.isAssignableFrom(referenceClass) || CoreClassConstants.DURATION.isAssignableFrom(referenceClass))) {
            // we're assuming that since we're unmarshalling to a primitive
            // wrapper, the root element has a single text node
            Object nodeVal;
            try {
                Text rootTxt = (Text) xmlRow.getDOM().getFirstChild();
                nodeVal = rootTxt.getNodeValue();
            } catch (Exception ex) {
                // here, either the root element doesn't have a text node as a
                // first child, or there is no first child at all - in any case,
                // try converting null
                nodeVal = null;
            }
            Object obj = xmlContext.getSession().getDatasourcePlatform().getConversionManager().convertObject(nodeVal, referenceClass);
            Root xmlRoot = new XMLRoot();
            xmlRoot.setObject(obj);
            String lName = xmlRow.getDOM().getLocalName();
            if (lName == null) {
                lName = xmlRow.getDOM().getNodeName();
            }
            xmlRoot.setLocalName(lName);
            xmlRoot.setNamespaceURI(xmlRow.getDOM().getNamespaceURI());
            xmlRoot.setEncoding(xmlEncoding);
            xmlRoot.setVersion(xmlVersion);
            return xmlRoot;
        }
        Descriptor descriptor = null;
        CoreAbstractSession readSession = null;
        boolean shouldWrap = true;
        if (referenceClass == null) {
            QName rootQName = new QName(xmlRow.getNamespaceURI(), xmlRow.getLocalName());
            descriptor = xmlContext.getDescriptor(rootQName);
            if (null == descriptor) {
                String type = ((Element) xmlRow.getDOM()).getAttributeNS(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "type");
                if (null != type) {
                    XPathFragment typeFragment = new XPathFragment(type);
                    String namespaceURI = xmlRow.resolveNamespacePrefix(typeFragment.getPrefix());
                    typeFragment.setNamespaceURI(namespaceURI);
                    descriptor = xmlContext.getDescriptorByGlobalType(typeFragment);
                }
            } else {
                if (null != descriptor.getDefaultRootElementField() && !descriptor.isResultAlwaysXMLRoot() && !xmlUnmarshaller.isResultAlwaysXMLRoot()) {
                    String descLocalName = descriptor.getDefaultRootElementField().getXPathFragment().getLocalName();
                    String localName = xmlRow.getDOM().getLocalName();
                    if (localName == null) {
                        localName = xmlRow.getDOM().getNodeName();
                    }
                    String namespaceURI = xmlRow.getDOM().getNamespaceURI();
                    if (descLocalName != null && descLocalName.equals(localName)) {
                        String descUri = descriptor.getDefaultRootElementField().getXPathFragment().getNamespaceURI();
                        if ((namespaceURI == null && descUri == null) || (namespaceURI != null && namespaceURI.length() == 0 && descUri == null) || (namespaceURI != null && namespaceURI.equals(descUri))) {
                            // found a descriptor based on root element then know we won't need to wrap in an XMLRoot
                            shouldWrap = false;
                        }
                    }
                }
            }
            if (null == descriptor) {
                throw XMLMarshalException.noDescriptorWithMatchingRootElement(rootQName.toString());
            } else {
                readSession = xmlContext.getSession(descriptor.getJavaClass());
            }
        } else {
            // for XMLObjectReferenceMappings we need a non-shared cache, so
            // try and get a Unit Of Work from the XMLContext
            readSession = xmlContext.getSession(referenceClass);
            descriptor = (Descriptor) readSession.getDescriptor(referenceClass);
            if (descriptor == null) {
                throw XMLMarshalException.descriptorNotFoundInProject(referenceClass.getName());
            }
        }
        Object object = null;
        if (null == xmlRow.getDOM().getAttributes().getNamedItemNS(javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, Constants.SCHEMA_NIL_ATTRIBUTE)) {
            xmlRow.setUnmarshaller(xmlUnmarshaller);
            xmlRow.setDocPresPolicy(xmlContext.getDocumentPreservationPolicy((AbstractSession) readSession));
            XMLObjectBuilder objectBuilder = (XMLObjectBuilder) descriptor.getObjectBuilder();
            ReadObjectQuery query = new ReadObjectQuery();
            query.setReferenceClass(referenceClass);
            query.setSession((AbstractSession) readSession);
            object = objectBuilder.buildObject(query, xmlRow, null);
            // resolve mapping references
            xmlRow.resolveReferences(readSession, xmlUnmarshaller.getIDResolver());
        }
        String elementNamespaceUri = xmlRow.getDOM().getNamespaceURI();
        String elementLocalName = xmlRow.getDOM().getLocalName();
        if (elementLocalName == null) {
            elementLocalName = xmlRow.getDOM().getNodeName();
        }
        String elementPrefix = xmlRow.getDOM().getPrefix();
        if (shouldWrap || descriptor.isResultAlwaysXMLRoot() || isResultAlwaysXMLRoot) {
            return descriptor.wrapObjectInXMLRoot(object, elementNamespaceUri, elementLocalName, elementPrefix, xmlEncoding, xmlVersion, this.isResultAlwaysXMLRoot, true, xmlUnmarshaller);
        } else {
            return object;
        }
    } finally {
        xmlUnmarshaller.getStringBuffer().reset();
    }
}
Also used : CoreAbstractSession(org.eclipse.persistence.internal.core.sessions.CoreAbstractSession) Root(org.eclipse.persistence.internal.oxm.Root) XMLRoot(org.eclipse.persistence.oxm.XMLRoot) ReadObjectQuery(org.eclipse.persistence.queries.ReadObjectQuery) XMLContext(org.eclipse.persistence.oxm.XMLContext) XMLRoot(org.eclipse.persistence.oxm.XMLRoot) QName(javax.xml.namespace.QName) Element(org.w3c.dom.Element) Text(org.w3c.dom.Text) XPathFragment(org.eclipse.persistence.internal.oxm.XPathFragment) XMLMarshalException(org.eclipse.persistence.exceptions.XMLMarshalException) IOException(java.io.IOException) XMLPlatformException(org.eclipse.persistence.platform.xml.XMLPlatformException) SAXException(org.xml.sax.SAXException) XMLObjectBuilder(org.eclipse.persistence.internal.oxm.XMLObjectBuilder) Descriptor(org.eclipse.persistence.internal.oxm.mappings.Descriptor) AbstractSession(org.eclipse.persistence.internal.sessions.AbstractSession) CoreAbstractSession(org.eclipse.persistence.internal.core.sessions.CoreAbstractSession)

Example 20 with XMLRoot

use of org.eclipse.persistence.oxm.XMLRoot in project eclipselink by eclipse-ee4j.

the class XMLAnyCollectionMapping method writeSingleValue.

@Override
public void writeSingleValue(Object element, Object parent, XMLRecord row, AbstractSession session) {
    XMLField xmlRootField = null;
    Object originalObject = element;
    DOMRecord record = (DOMRecord) row;
    Node root = record.getDOM();
    org.w3c.dom.Document doc = row.getDocument();
    boolean wasXMLRoot = false;
    if (usesXMLRoot() && (element instanceof XMLRoot)) {
        wasXMLRoot = true;
        xmlRootField = new XMLField();
        XPathFragment frag = new XPathFragment();
        if ((((XMLRoot) element)).getNamespaceURI() != null) {
            frag.setNamespaceURI(((XMLRoot) element).getNamespaceURI());
        }
        frag.setLocalName(((XMLRoot) element).getLocalName());
        xmlRootField.setXPathFragment(frag);
        xmlRootField.setNamespaceResolver(row.getNamespaceResolver());
        element = ((XMLRoot) element).getObject();
    }
    if (element instanceof String) {
        writeSimpleValue(xmlRootField, element, originalObject, record, doc, root, wasXMLRoot, session);
    } else if (element instanceof org.w3c.dom.Node) {
        Node importedCopy = doc.importNode((Node) element, true);
        root.appendChild(importedCopy);
    } else {
        XMLDescriptor referenceDescriptor = (XMLDescriptor) session.getDescriptor(element.getClass());
        if (referenceDescriptor == null) {
            writeSimpleValue(xmlRootField, element, originalObject, record, doc, root, wasXMLRoot, session);
            return;
        }
        if (wasXMLRoot) {
            if (((XMLRoot) originalObject).getNamespaceURI() != null) {
                String prefix = referenceDescriptor.getNonNullNamespaceResolver().resolveNamespaceURI(((XMLRoot) originalObject).getNamespaceURI());
                if ((prefix == null) || prefix.length() == 0) {
                    prefix = record.getNamespaceResolver().resolveNamespaceURI(((XMLRoot) originalObject).getNamespaceURI());
                }
                if ((prefix == null) || prefix.length() == 0) {
                    xmlRootField.getXPathFragment().setGeneratedPrefix(true);
                    prefix = record.getNamespaceResolver().generatePrefix();
                }
                xmlRootField.getXPathFragment().setXPath(prefix + XMLConstants.COLON + ((XMLRoot) originalObject).getLocalName());
            }
        }
        DOMRecord nestedRecord = (DOMRecord) buildCompositeRow(element, session, referenceDescriptor, row, xmlRootField, originalObject, wasXMLRoot);
        if (nestedRecord != null) {
            root.appendChild(nestedRecord.getDOM());
        }
    }
}
Also used : XMLField(org.eclipse.persistence.oxm.XMLField) DOMRecord(org.eclipse.persistence.oxm.record.DOMRecord) XMLRoot(org.eclipse.persistence.oxm.XMLRoot) Node(org.w3c.dom.Node) XPathFragment(org.eclipse.persistence.internal.oxm.XPathFragment) XMLDescriptor(org.eclipse.persistence.oxm.XMLDescriptor) Node(org.w3c.dom.Node)

Aggregations

XMLRoot (org.eclipse.persistence.oxm.XMLRoot)126 XMLDescriptor (org.eclipse.persistence.oxm.XMLDescriptor)34 Document (org.w3c.dom.Document)28 SAXException (org.xml.sax.SAXException)17 StringWriter (java.io.StringWriter)16 Person (org.eclipse.persistence.testing.oxm.xmlroot.Person)13 IOException (java.io.IOException)12 ArrayList (java.util.ArrayList)11 Vector (java.util.Vector)11 Node (org.w3c.dom.Node)11 QName (javax.xml.namespace.QName)10 XMLOutputFactory (javax.xml.stream.XMLOutputFactory)10 Element (org.w3c.dom.Element)10 StringReader (java.io.StringReader)9 InputSource (org.xml.sax.InputSource)9 DataObject (commonj.sdo.DataObject)8 JAXBException (jakarta.xml.bind.JAXBException)8 InputStream (java.io.InputStream)8 MalformedURLException (java.net.MalformedURLException)8 XMLStreamException (javax.xml.stream.XMLStreamException)8