Package org.apache.ws.commons.schema

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


        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


            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

        createElementWithImportedType(importingSchema);

        createImportedAttribute(attributeSchema);

        XmlSchemaAttribute importingAttribute = new XmlSchemaAttribute(importingSchema, false);
        importingAttribute.getRef().setTargetQName(new QName(ATTRIBUTE_SCHEMA, "imported"));
        // borrow derivedType1 to make the reference.
        derivedType1Extension.getAttributes().add(importingAttribute);

        createImportedAttributeType(attributeTypeSchema);
View Full Code Here

        schema.setNamespaceContext(map);
        return schema;
    }

    private void createAttributeImportingType(XmlSchema importingSchema) {
        XmlSchemaAttribute attributeImportingType = new XmlSchemaAttribute(importingSchema, true);
        attributeImportingType.setName("importingType");
        attributeImportingType.setSchemaTypeName(new QName(ATTRIBUTE_TYPE_SCHEMA, "importedAttributeType"));
    }
View Full Code Here

        attributeImportedType.setContent(simpleContent);
        simpleContent.setBaseTypeName(new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "string"));
    }

    private void createImportedAttribute(XmlSchema attributeSchema) {
        XmlSchemaAttribute importedAttribute = new XmlSchemaAttribute(attributeSchema, true);
        importedAttribute.setName("imported");
        importedAttribute.setSchemaTypeName(new QName(XMLConstants.W3C_XML_SCHEMA_NS_URI, "string"));
    }
View Full Code Here

        boolean howdy = false;
        boolean bleh = false;
        for (int x = 0; x < stype.getAttributes().getCount(); x++) {
            XmlSchemaObject o = stype.getAttributes().getItem(x);
            if (o instanceof XmlSchemaAttribute) {
                XmlSchemaAttribute a = (XmlSchemaAttribute)o;
                if ("howdy".equals(a.getName())) {
                    howdy = true;
                }
                if ("bleh".equals(a.getName())) {
                    bleh = true;
                }
            }
        }
        assertTrue(howdy);
View Full Code Here

        }

        for (int x = 0; x < stype.getAttributes().getCount(); x++) {
            XmlSchemaObject o = stype.getAttributes().getItem(x);
            if (o instanceof XmlSchemaAttribute) {
                XmlSchemaAttribute a = (XmlSchemaAttribute)o;
                if ("howdy".equals(a.getName())) {
                    howdy = true;
                }
            }
        }
View Full Code Here

        boolean howdy = false;
        boolean bleh = false;
        for (int x = 0; x < stype.getAttributes().size(); x++) {
            XmlSchemaObject o = stype.getAttributes().get(x);
            if (o instanceof XmlSchemaAttribute) {
                XmlSchemaAttribute a = (XmlSchemaAttribute)o;
                if ("howdy".equals(a.getName())) {
                    howdy = true;
                }
                if ("bleh".equals(a.getName())) {
                    bleh = true;
                }
            }
        }
        assertTrue(howdy);
View Full Code Here

        }

        for (int x = 0; x < stype.getAttributes().size(); x++) {
            XmlSchemaObject o = stype.getAttributes().get(x);
            if (o instanceof XmlSchemaAttribute) {
                XmlSchemaAttribute a = (XmlSchemaAttribute)o;
                if ("howdy".equals(a.getName())) {
                    howdy = true;
                }
            }
        }
View Full Code Here

    public XmlSchemaAttribute getAttributeByQName(QName qname) {
        String uri = qname.getNamespaceURI();
        for (XmlSchema schema : schemaCollection.getXmlSchemas()) {
            if (uri.equals(schema.getTargetNamespace())) {
                XmlSchemaObjectTable attributes = schema.getAttributes();
                XmlSchemaAttribute attribute = (XmlSchemaAttribute)attributes.getItem(qname);
                if (attribute != null) {
                    return attribute;
                }
            }
        }
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.