Package org.eclipse.persistence.jaxb.xmlmodel

Examples of org.eclipse.persistence.jaxb.xmlmodel.XmlElementWrapper


       
        if (xmlVariableNode.getXmlPath() != null) {
            oldProperty.setXmlPath(xmlVariableNode.getXmlPath());
        } else {
            // no xml-path, so use name/namespace from xml-element, and process wrapper
            XmlElementWrapper xmlElementWrapper = xmlVariableNode.getXmlElementWrapper();
            if (xmlElementWrapper != null) {
                if (DEFAULT.equals(xmlElementWrapper.getName())) {
                    xmlElementWrapper.setName(tInfo.getXmlNameTransformer().transformElementName(oldProperty.getPropertyName()));
                }
                oldProperty.setXmlElementWrapper(xmlVariableNode.getXmlElementWrapper());
            }
        }
View Full Code Here


            namespace = DEFAULT;
        } else {
            // no xml-path, so use name/namespace from xml-element, and process wrapper
            name = xmlElement.getName();
            namespace = xmlElement.getNamespace();
            XmlElementWrapper xmlElementWrapper = xmlElement.getXmlElementWrapper();
            if (xmlElementWrapper != null) {
                if (DEFAULT.equals(xmlElementWrapper.getName())) {
                    xmlElementWrapper.setName(typeInfo.getXmlNameTransformer().transformElementName(oldProperty.getPropertyName()));
                }
                oldProperty.setXmlElementWrapper(xmlElement.getXmlElementWrapper());
                if(oldProperty.isMap()){
                  name = xmlElement.getXmlElementWrapper().getName();
                    namespace = xmlElement.getXmlElementWrapper().getNamespace();
View Full Code Here

   
    public XMLField getXPathForField(Property property, NamespaceInfo namespaceInfo, boolean isTextMapping) {
        String xPath = "";
        XMLField xmlField = null;
        if (property.isSetXmlElementWrapper()) {
            XmlElementWrapper wrapper = property.getXmlElementWrapper();
            String namespace = wrapper.getNamespace();
            if (namespace.equals("##default")) {
                if (namespaceInfo.isElementFormQualified()) {
                    namespace = namespaceInfo.getNamespace();
                } else {
                    namespace = "";
                }
            }
            if (namespace.equals("")) {
                xPath += (wrapper.getName() + "/");
            } else {
              String prefix = getPrefixForNamespace(namespace, namespaceInfo.getNamespaceResolver(), null);
              xPath += getQualifiedString(prefix, wrapper.getName() + "/");
            }
        }
        if (property.isAttribute()) {
            QName name = property.getSchemaName();
            String namespace = "";
View Full Code Here

            boolean isChoice = (parentCompositor instanceof Choice);
            ComplexType parentType = type;
            if (!helper.isAnnotationPresent(next.getElement(), XmlTransient.class)) {
                // deal with the XmlElementWrapper case
                if (!isChoice && next.isSetXmlElementWrapper()) {
                    XmlElementWrapper wrapper = next.getXmlElementWrapper();
                    Element wrapperElement = new Element();
                    String name = wrapper.getName();
                    if (name.equals("##default")) {
                        name = next.getPropertyName();
                    }
                    // handle nillable
                    wrapperElement.setNillable(wrapper.isNillable());

                    // namespace in not the target or ##default, create a ref with min/max = 1
                    String wrapperNS = wrapper.getNamespace();
                    if (!wrapperNS.equals("##default") && !wrapperNS.equals(schema.getTargetNamespace())) {
                        wrapperElement.setMinOccurs(Occurs.ONE);
                        wrapperElement.setMaxOccurs(Occurs.ONE);

                        String prefix = getOrGeneratePrefixForNamespace(wrapperNS, schema);
                        wrapperElement.setRef(prefix + ":" + name);
                        compositor.addElement(wrapperElement);
                        // assume that the element exists and does not need to be created
                        continue;
                    } else {
                        wrapperElement.setName(name);
                        if (wrapper.isRequired()) {
                            wrapperElement.setMinOccurs(Occurs.ONE);
                        } else {
                            wrapperElement.setMinOccurs(Occurs.ZERO);
                        }
                        compositor.addElement(wrapperElement);
View Full Code Here

            mapping.setAttributeAccessor(accessor);
        }
        String wrapperXPath = "";
        // handle XmlElementWrapper
        if (property.isSetXmlElementWrapper()) {
            XmlElementWrapper wrapper = property.getXmlElementWrapper();
            String namespace = wrapper.getNamespace();
            if (namespace.equals(XMLProcessor.DEFAULT)) {
                if (namespaceInfo.isElementFormQualified()) {
                    namespace = namespaceInfo.getNamespace();
                } else {
                    namespace = "";
                }
            }
            if (namespace.equals("")) {
                wrapperXPath += (wrapper.getName() + "/");
            } else {
                String prefix = getPrefixForNamespace(namespace, namespaceInfo.getNamespaceResolver());
                wrapperXPath += getQualifiedString(prefix, wrapper.getName() + "/");
            }
        }       
        if(property.isMixedContent() && isCollection) {
            if(wrapperXPath.length() == 0) {
                ((ChoiceCollectionMapping)mapping).setMixedContent(true);
View Full Code Here

            String newXPath = prefixCustomXPath(xPath, property, namespaceInfo);
            xmlField = new XMLField(newXPath);
        } else {
            StringBuilder xPathBuilder = new StringBuilder();
            if (property.isSetXmlElementWrapper()) {
                XmlElementWrapper wrapper = property.getXmlElementWrapper();
                String namespace = wrapper.getNamespace();
                if (namespace.equals(XMLProcessor.DEFAULT)) {
                    if (namespaceInfo.isElementFormQualified()) {
                        namespace = namespaceInfo.getNamespace();
                    } else {
                        namespace = "";
                    }
                }

                if (namespace.equals("")) {
                    xPathBuilder.append(wrapper.getName()).append("/");
                } else {
      String prefix = getPrefixForNamespace(namespace, namespaceInfo.getNamespaceResolverForDescriptor());
      xPathBuilder.append(getQualifiedString(prefix, wrapper.getName() + "/"));
                }

                if (isAny || property.isMap()) {
                    xmlField = new XMLField(xPathBuilder.toString());
                    return xmlField;
View Full Code Here

     * @param schema the schema currently being generated
     * @param compositor sequence/choice/all that the generated wrapper Element will be added to
     * @return AddToSchemaResult containing current ComplexType and TypeDefParticle
     */
    private AddToSchemaResult addXmlElementWrapperToSchema(Property property, Schema schema, TypeDefParticle compositor) {
        XmlElementWrapper wrapper = property.getXmlElementWrapper();
        Element wrapperElement = new Element();
        String name = wrapper.getName();
        if (name.equals(DEFAULT)) {
            name = property.getPropertyName();
        }
        // handle nillable
        wrapperElement.setNillable(wrapper.isNillable());

        // namespace in not the target or ##default, create a ref with min/max = 1
        String wrapperNS = wrapper.getNamespace();
        if (!wrapperNS.equals(DEFAULT) && !wrapperNS.equals(schema.getTargetNamespace())) {
            wrapperElement.setMinOccurs(Occurs.ONE);
            wrapperElement.setMaxOccurs(Occurs.ONE);

            String prefix = getOrGeneratePrefixForNamespace(wrapperNS, schema);
            wrapperElement.setRef(prefix + COLON + name);
            compositor.addElement(wrapperElement);
            // assume that the element exists and does not need to be created
            return null;
        }
        wrapperElement.setName(name);
        if (wrapper.isRequired()) {
            wrapperElement.setMinOccurs(Occurs.ONE);
        } else {
            wrapperElement.setMinOccurs(Occurs.ZERO);
        }
        compositor.addElement(wrapperElement);
View Full Code Here

            mapping.setAttributeAccessor(accessor);
        }
        String wrapperXPath = "";
        // handle XmlElementWrapper
        if (property.isSetXmlElementWrapper()) {
            XmlElementWrapper wrapper = property.getXmlElementWrapper();
            String namespace = wrapper.getNamespace();
            if (namespace.equals("##default")) {
                if (namespaceInfo.isElementFormQualified()) {
                    namespace = namespaceInfo.getNamespace();
                } else {
                    namespace = "";
                }
            }
            if (namespace.equals("")) {
                wrapperXPath += (wrapper.getName() + "/");
            } else {
                String prefix = getPrefixForNamespace(namespace, namespaceInfo.getNamespaceResolver(), null);
                wrapperXPath += getQualifiedString(prefix, wrapper.getName() + "/");
            }
        }       
        if(property.isMixedContent() && isCollection) {
            if(wrapperXPath.length() == 0) {
                ((XMLChoiceCollectionMapping)mapping).setMixedContent(true);
View Full Code Here

        if (property.getXmlPath() != null) {
            xmlField = new XMLField(property.getXmlPath());
        } else {
            String xPath = "";
            if (property.isSetXmlElementWrapper()) {
                XmlElementWrapper wrapper = property.getXmlElementWrapper();
                String namespace = wrapper.getNamespace();
                if (namespace.equals("##default")) {
                    if (namespaceInfo.isElementFormQualified()) {
                        namespace = namespaceInfo.getNamespace();
                    } else {
                        namespace = "";
                    }
                }
                if (namespace.equals("")) {
                    xPath += (wrapper.getName() + "/");
                } else {
                  String prefix = getPrefixForNamespace(namespace, namespaceInfo.getNamespaceResolverForDescriptor(), null);
                  xPath += getQualifiedString(prefix, wrapper.getName() + "/");
                }
            }
            if (property.isAttribute()) {
                if (property.isSetXmlPath()) {
                    xPath += property.getXmlPath();
View Full Code Here

                        if (parentCompositor.getOwner() instanceof ComplexType) {
                            parentType = ((ComplexType)parentCompositor.getOwner());
                        }
                    // deal with the XmlElementWrapper case
                    } else if (!isChoice && next.isSetXmlElementWrapper()) {
                        XmlElementWrapper wrapper = next.getXmlElementWrapper();
                        Element wrapperElement = new Element();
                        String name = wrapper.getName();
                        if (name.equals("##default")) {
                            name = next.getPropertyName();
                        }
                        // handle nillable
                        wrapperElement.setNillable(wrapper.isNillable());
   
                        // namespace in not the target or ##default, create a ref with min/max = 1
                        String wrapperNS = wrapper.getNamespace();
                        if (!wrapperNS.equals("##default") && !wrapperNS.equals(currentSchema.getTargetNamespace())) {
                            wrapperElement.setMinOccurs(Occurs.ONE);
                            wrapperElement.setMaxOccurs(Occurs.ONE);
   
                            String prefix = getOrGeneratePrefixForNamespace(wrapperNS, currentSchema);
                            wrapperElement.setRef(prefix + ":" + name);
                            compositor.addElement(wrapperElement);
                            // assume that the element exists and does not need to be created
                            continue;
                        } else {
                            wrapperElement.setName(name);
                            if (wrapper.isRequired()) {
                                wrapperElement.setMinOccurs(Occurs.ONE);
                            } else {
                                wrapperElement.setMinOccurs(Occurs.ZERO);
                            }
                            compositor.addElement(wrapperElement);
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jaxb.xmlmodel.XmlElementWrapper

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.