Package org.eclipse.persistence.oxm

Examples of org.eclipse.persistence.oxm.XMLRoot


      Object iterator = containerPolicy.iteratorFor(value);
      while(containerPolicy.hasNext(iterator)) {
        Object next = containerPolicy.next(iterator, null);
        if(next instanceof JAXBElement) {
          JAXBElement element = (JAXBElement)next;
          XMLRoot root = new XMLRoot();
          root.setLocalName(element.getName().getLocalPart());
          root.setNamespaceURI(element.getName().getNamespaceURI());
          root.setObject(element.getValue());
          containerPolicy.addInto(root, results, null);
        } else {
          containerPolicy.addInto(next, results, null);
        }
      }
      value = results;
    } else {
      if(value instanceof JAXBElement) {
        JAXBElement element = (JAXBElement)value;
        XMLRoot root = new XMLRoot();
        root.setLocalName(element.getName().getLocalPart());
        root.setNamespaceURI(element.getName().getNamespaceURI());
        root.setObject(element.getValue());
        value = root;
      }
    }
    return value;
  }
View Full Code Here


      Object results = containerPolicy.containerInstance(containerPolicy.sizeFor(attributeValue));
      Object iterator = containerPolicy.iteratorFor(attributeValue);
      while(containerPolicy.hasNext(iterator)) {
        Object next = containerPolicy.next(iterator, null);
        if(next instanceof XMLRoot) {
          XMLRoot root = (XMLRoot)next;
          QName name = new QName(root.getNamespaceURI(), root.getLocalName());
          JAXBElement element = new JAXBElement(name, root.getObject().getClass(), root.getObject());
          containerPolicy.addInto(element, results, null);
        } else {
          containerPolicy.addInto(next, results, null);
        }
      }
      attributeValue = results;
    } else {
      if(attributeValue instanceof XMLRoot) {
        XMLRoot root = (XMLRoot)attributeValue;
        QName name = new QName(root.getNamespaceURI(), root.getLocalName());
        JAXBElement element = new JAXBElement(name, root.getObject().getClass(), root.getObject());
        attributeValue = element;
      }     
    }
    nestedAccessor.setAttributeValueInObject(object, attributeValue);
  }
View Full Code Here

                // try converting null
                nodeVal = null;
            }
 
            Object obj = ((XMLConversionManager) xmlContext.getSession(0).getDatasourcePlatform().getConversionManager()).convertObject(nodeVal, referenceClass);
            XMLRoot 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;
        }

        // for XMLObjectReferenceMappings we need a non-shared cache, so
        // try and get a Unit Of Work from the XMLContext
View Full Code Here

    public void marshalSingleValue(XPathFragment xPathFragment, MarshalRecord marshalRecord, Object object, Object value, AbstractSession session, NamespaceResolver namespaceResolver, MarshalContext marshalContext) {
      NodeValue associatedNodeValue = null;
      XMLField associatedField = null;
      Object fieldValue = value;
      if(value instanceof XMLRoot) {
        XMLRoot rootValue = (XMLRoot)value;
        String localName = rootValue.getLocalName();
        String namespaceUri = rootValue.getNamespaceURI();
        fieldValue = rootValue.getObject();
        associatedField = getFieldForName(localName, namespaceUri);
        if(associatedField == null) {
          associatedField = xmlChoiceCollectionMapping.getClassToFieldMappings().get(value.getClass());
        }
      } else {
View Full Code Here

            }

            if (!xmlAnyCollectionMapping.usesXMLRoot()) {
                unmarshalRecord.addAttributeValue(this, value);
            } else {
                XMLRoot xmlRoot = new XMLRoot();
                xmlRoot.setNamespaceURI(xPathFragment.getNamespaceURI());
                xmlRoot.setLocalName(xPathFragment.getLocalName());
                xmlRoot.setSchemaType(qname);
                xmlRoot.setObject(value);
                unmarshalRecord.addAttributeValue(this, xmlRoot);
            }
        }
    }
View Full Code Here

    public XMLDocument load(InputSource inputSource, String locationURI, Object options) throws IOException {
        if(null == inputSource) {
            return super.load(inputSource, locationURI, options);
        }
        try {
            XMLRoot xmlRoot = (XMLRoot) createXMLUnmarshaller().unmarshal(inputSource);
            return wrap(xmlRoot);
        } catch (XMLMarshalException xmlMarshalException) {
            return handleLoadException(xmlMarshalException);
        }
    }
View Full Code Here

    public XMLDocument load(InputStream inputStream) throws IOException {
        if(null == inputStream) {
            return super.load(inputStream);
        }
        try {
            XMLRoot xmlRoot = (XMLRoot) createXMLUnmarshaller().unmarshal(inputStream);
            return wrap(xmlRoot);
        } catch(XMLMarshalException xmlMarshalException) {
            return handleLoadException(xmlMarshalException);
        }
    }
View Full Code Here

    public XMLDocument load(Reader inputReader, String locationURI, Object options) throws IOException {
        if(null == inputReader) {
            return super.load(inputReader, locationURI, options);
        }
        try {
            XMLRoot xmlRoot = (XMLRoot) createXMLUnmarshaller().unmarshal(inputReader);
            return wrap(xmlRoot);
        } catch(XMLMarshalException xmlMarshalException) {
            return handleLoadException(xmlMarshalException);
        }
    }
View Full Code Here

    public XMLDocument load(Source source, String locationURI, Object options) throws IOException {
        if(null == source) {
            return super.load(source, locationURI, options);
        }
        try {
            XMLRoot xmlRoot = (XMLRoot) createXMLUnmarshaller().unmarshal(source);
            return wrap(xmlRoot);
        } catch(XMLMarshalException xmlMarshalException) {
            return handleLoadException(xmlMarshalException);
        }
    }
View Full Code Here

            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();
            xmlroot.setObject(value);//set the object to the deep copy           
            xmlroot.setNamespaceURI(uri);
            xmlroot.setLocalName(qualifiedName);
            xmlMarshaller.marshal(xmlroot, csNode);
        } else {
            //need sdoref
            Element modifiedElement = null;
            if (uri == null) {
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.oxm.XMLRoot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.