Package org.apache.ws.commons.schema

Examples of org.apache.ws.commons.schema.XmlSchemaAttribute


            sequence.getItems().add(any);
        }

        // Write out schema for attributes
        for (QName name : inf.getAttributes()) {
            XmlSchemaAttribute attribute = new XmlSchemaAttribute(root, false);
            complex.getAttributes().add(attribute);
            attribute.setName(name.getLocalPart());
            AegisType type = getType(inf, name);
            attribute.setSchemaTypeName(type.getSchemaType());
            String ns = name.getNamespaceURI();
            if (!ns.equals(root.getTargetNamespace())) {
                XmlSchemaUtils.addImportIfNeeded(root, ns);
            }
        }
View Full Code Here


        for (XmlSchemaAttributeOrGroupRef aog : list) {
            if (!(aog instanceof XmlSchemaAttribute)) {
                LOG.warning(aog.getClass() + " not supported in CORBA binding.  Skipping.");
                continue;
            }
            XmlSchemaAttribute attribute = (XmlSchemaAttribute) aog;
            QName attrName = attribute.getQName();
            if (attrName.getNamespaceURI().equals("")) {
                attrName = new QName(uri, attrName.getLocalPart());
            }
            CorbaTypeImpl membertype = null;
            boolean attrQualified = getAttributeQualification(attribute, uri);
            if (attribute.getUse() == XmlSchemaUse.NONE
                || attribute.getUse() == XmlSchemaUse.OPTIONAL) {
                CorbaTypeImpl attType = null;
                if (attribute.getSchemaType() != null) {
                    // REVISIT, edell bug in XmlSchema 1.2.
                    // https://issues.apache.org/jira/browse/WSCOMMONS-208
                    attType = convertSchemaToCorbaType(attribute.getSchemaType(),
                                                       checkPrefix(attrName),
                                                       attribute.getSchemaType(),
                                                       null, true);
                    if (attType != null) {
                        QName typeName = attType.getQName();
                        if (!isDuplicate(attType)) {
                            typeMappingType.getStructOrExceptionOrUnion().add(attType);
                        }
                        QName name =  createQNameTargetNamespace(typeName.getLocalPart() + "_nil");
                        membertype = createNillableUnion(name,
                                                         checkPrefix(attrName),
                                                         createQNameCorbaNamespace(typeName.getLocalPart()),
                                                         attrQualified);
                    }
                } else {
                    attType = processPrimitiveType(attribute.getSchemaTypeName());
                    //REVISIT, bravi, attType is null for the wsaddr type
                    //{http://www.w3.org/2005/08/addressing}RelationshipTypeOpenEnum
                    if (attType != null) {
                        QName name =  createQNameTargetNamespace(attType.getQName().getLocalPart() + "_nil");
                        //REVISIT, Edell - bug in Xmlschema 1.2
                        // https://issues.apache.org/jira/browse/WSCOMMONS-208
                        membertype = createNillableUnion(name,
                                                         checkPrefix(attrName),
                                                         attType.getQName(),
                                                         attrQualified);
                    }

                }
                if (membertype != null) {
                    memName = createQNameCorbaNamespace(membertype.getQName().getLocalPart());
                    if (!isDuplicate(membertype)) {
                        typeMappingType.getStructOrExceptionOrUnion().add(membertype);
                    }
                }
            } else {
                if (attribute.getSchemaType() != null) {
                    membertype = convertSchemaToCorbaType(attribute.getSchemaType(), attrName,
                                                          attribute.getSchemaType(), null, false);
                } else {
                    membertype = processPrimitiveType(attribute.getSchemaTypeName());
                }
            }

            if (membertype != null) {
                MemberType member;
View Full Code Here

          while (itemIterator.hasNext()) {
                Object attr = itemIterator.next();

                if (attr instanceof XmlSchemaAttribute) {
                  XmlSchemaAttribute attribute  = (XmlSchemaAttribute) attr;

                  if (attribute.getName().equals(att.getRefName().getLocalPart())) {
                    QName attrTypeName = attribute.getSchemaTypeName();

                    Object type = baseSchemaTypeMap.get(attrTypeName);
                    if (type == null) {
                      XmlSchemaSimpleType simpleType = attribute.getSchemaType();
                            if(simpleType != null && simpleType.getContent() instanceof XmlSchemaSimpleTypeRestriction) {
                                XmlSchemaSimpleTypeRestriction restriction = (XmlSchemaSimpleTypeRestriction) simpleType.getContent();
                                QName baseTypeName = restriction.getBaseTypeName();
                                type = baseSchemaTypeMap.get(baseTypeName);
                                attrQname = att.getRefName();
View Full Code Here

            if (!isSoapArray(complexType)) {
                final XmlSchemaObjectCollection attributes = complexType.getAttributes();
                for (final Iterator iterator = attributes.getIterator(); iterator.hasNext(); ) {
                    final Object item = iterator.next();
                    if (item instanceof XmlSchemaAttribute) {
                        final XmlSchemaAttribute attribute = (XmlSchemaAttribute) item;
                        final Object old = typeInfo.attributes.put(attribute.getQName().getLocalPart(), attribute.getSchemaTypeName());
                        if (old != null) {
                            throw new IllegalArgumentException("Complain to your expert group member, spec does not support attributes with the same local name and differing namespaces: original: " + old + ", duplicate local name: " + attribute);
                        }
                    }
                }
View Full Code Here

        // </complexType>
        final XmlSchemaObjectCollection attributes = restriction.getAttributes();
        for (final Iterator iterator = attributes.getIterator(); iterator.hasNext(); ) {
            final Object item = iterator.next();
            if (item instanceof XmlSchemaAttribute) {
                final XmlSchemaAttribute attribute = (XmlSchemaAttribute) item;
                if (attribute.getRefName().equals(SOAP_ARRAY_TYPE)) {
                    for (final Attr attr : attribute.getUnhandledAttributes()) {
                        final QName attQName = new QName(attr.getNamespaceURI(), attr.getLocalName());
                        if (WSDL_ARRAY_TYPE.equals(attQName)) {
                            // value is a namespace prefixed xsd type
                            final String value = attr.getValue();
View Full Code Here

            if (isInheritedProperty(inf, name)) {
                continue;
            }

            XmlSchemaAttribute attribute = new XmlSchemaAttribute(root, false);
            complex.getAttributes().add(attribute);
            attribute.setName(name.getLocalPart());
            AegisType type = getType(inf, name);
            attribute.setSchemaTypeName(type.getSchemaType());
            String ns = name.getNamespaceURI();
            if (!ns.equals(root.getTargetNamespace())) {
                XmlSchemaUtils.addImportIfNeeded(root, ns);
            }
        }
View Full Code Here

            Object attrObj = attrs.next();
            if (!(attrObj instanceof XmlSchemaAttribute)) {
                LOG.warning(attrObj.getClass() + " not supported in CORBA binding.  Skipping.");
                continue;
            }
            XmlSchemaAttribute attribute = (XmlSchemaAttribute)attrObj;
            QName attrName = attribute.getQName();
            if (attrName.getNamespaceURI().equals("")) {
                attrName = new QName(uri, attrName.getLocalPart());
            }
            CorbaTypeImpl membertype = null;
            boolean attrQualified = getAttributeQualification(attribute, uri);
            if (attribute.getUse().getValue().equals("none")
                || attribute.getUse().getValue().equals(W3CConstants.USE_OPTIONAL)) {               
                CorbaTypeImpl attType = null;
                if (attribute.getSchemaType() != null) {
                    // REVISIT, edell bug in XmlSchema 1.2.
                    // https://issues.apache.org/jira/browse/WSCOMMONS-208
                    attType = convertSchemaToCorbaType(attribute.getSchemaType(),
                                                       checkPrefix(attrName),
                                                       attribute.getSchemaType(),
                                                       null, true);                  
                    if (attType != null) {
                        QName typeName = attType.getQName();
                        if (!isDuplicate(attType)) {
                            typeMappingType.getStructOrExceptionOrUnion().add(attType);
                        }
                        QName name =  createQNameTargetNamespace(typeName.getLocalPart() + "_nil");
                        membertype = createNillableUnion(name,
                                                         checkPrefix(attrName),
                                                         createQNameCorbaNamespace(typeName.getLocalPart()),
                                                         attrQualified);
                    }
                } else {
                    attType = processPrimitiveType(attribute.getSchemaTypeName());
                    //REVISIT, bravi, attType is null for the wsaddr type
                    //{http://www.w3.org/2005/08/addressing}RelationshipTypeOpenEnum
                    if (attType != null) {
                        QName name =  createQNameTargetNamespace(attType.getQName().getLocalPart() + "_nil");
                        //REVISIT, Edell - bug in Xmlschema 1.2
                        // https://issues.apache.org/jira/browse/WSCOMMONS-208
                        membertype = createNillableUnion(name,
                                                         checkPrefix(attrName),
                                                         attType.getQName(),
                                                         attrQualified);
                    }

                }
                if (membertype != null) {
                    memName = createQNameCorbaNamespace(membertype.getQName().getLocalPart());
                    if (!isDuplicate(membertype)) {
                        typeMappingType.getStructOrExceptionOrUnion().add(membertype);
                    }
                }
            } else {
                if (attribute.getSchemaType() != null) {
                    membertype = convertSchemaToCorbaType(attribute.getSchemaType(), attrName,
                                                          attribute.getSchemaType(), null, false);
                } else {
                    membertype = processPrimitiveType(attribute.getSchemaTypeName());
                }
            }

            if (membertype != null) {
                MemberType member;
View Full Code Here

            if (!isSoapArray(complexType)) {
                XmlSchemaObjectCollection attributes = complexType.getAttributes();
                for (Iterator iterator = attributes.getIterator(); iterator.hasNext();) {
                    Object item = iterator.next();
                    if (item instanceof XmlSchemaAttribute) {
                        XmlSchemaAttribute attribute = (XmlSchemaAttribute) item;
                        Object old = typeInfo.attributes.put(attribute.getQName().getLocalPart(), attribute.getSchemaTypeName());
                        if (old != null) {
                            throw new IllegalArgumentException("Complain to your expert group member, spec does not support attributes with the same local name and differing namespaces: original: " + old + ", duplicate local name: " + attribute);
                        }
                    }
                }
View Full Code Here

        // </complexType>
        XmlSchemaObjectCollection attributes = restriction.getAttributes();
        for (Iterator iterator = attributes.getIterator(); iterator.hasNext();) {
            Object item = iterator.next();
            if (item instanceof XmlSchemaAttribute) {
                XmlSchemaAttribute attribute = (XmlSchemaAttribute) item;
                if (attribute.getRefName().equals(SOAP_ARRAY_TYPE)) {
                    for (Attr attr : attribute.getUnhandledAttributes()) {
                        QName attQName = new QName(attr.getNamespaceURI(), attr.getLocalName());
                        if (WSDL_ARRAY_TYPE.equals(attQName)) {
                            // value is a namespace prefixed xsd type
                            String value = attr.getValue();
View Full Code Here

            XmlSchema resolvedSchema = getParentSchema(parentSchema,att.getRefName(),COMPONENT_ATTRIBUTE);
            if (resolvedSchema == null){
                throw new SchemaCompilationException("can not find the attribute " + att.getRefName() +
                " from the parent schema " + parentSchema.getTargetNamespace());
            } else {
                XmlSchemaAttribute xmlSchemaAttribute =
                        (XmlSchemaAttribute) resolvedSchema.getAttributes().getItem(att.getRefName());
                if (xmlSchemaAttribute != null) {
                    // call recursively to process the schema
                    processAttribute(xmlSchemaAttribute, metainf, resolvedSchema);
                } else {
View Full Code Here

TOP

Related Classes of org.apache.ws.commons.schema.XmlSchemaAttribute

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.