Package org.apache.ws.commons.schema

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


        for (int x = 0; x < schema.getItems().getCount(); x++) {
            XmlSchemaObject item = schema.getItems().getItem(x);
            if (item instanceof XmlSchemaElement) {
                addElementCrossImportsElement(schema, item);
            } else if (item instanceof XmlSchemaAttribute) {
                XmlSchemaAttribute attr = (XmlSchemaAttribute)item;
                XmlSchemaUtils.addImportIfNeeded(schema, attr.getRefName());
                XmlSchemaUtils.addImportIfNeeded(schema, attr.getSchemaTypeName());
                if (attr.getSchemaType() != null) {
                    XmlSchemaUtils.addImportIfNeeded(schema, attr.getSchemaType().getBaseSchemaTypeName());
                }
            } else if (item instanceof XmlSchemaType) {
                XmlSchemaType type = (XmlSchemaType)item;
                addCrossImportsType(schema, type);
            }
View Full Code Here


        }
    }

    private void addCrossImportsAttributeList(XmlSchema schema, XmlSchemaObjectCollection attributes) {
        for (int x = 0; x < attributes.getCount(); x++) {
            XmlSchemaAttribute attr = (XmlSchemaAttribute)attributes.getItem(x);
            XmlSchemaUtils.addImportIfNeeded(schema, attr.getRefName());
        }
    }
View Full Code Here

        Set s = new HashSet();
        s.add("units");
        s.add("id");
        for (int i = 0; i < xsoc.getCount(); i++) {
            XmlSchemaAttribute xsa = (XmlSchemaAttribute)xsoc.getItem(i);
            String name = xsa.getName();
            if (name.equals("units")) {
                assertEquals(new QName("http://soapinterop.org/types", "units"),
                             xsa.getQName());
                assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"),
                             xsa.getSchemaTypeName());
                assertNull(xsa.getDefaultValue());
                assertEquals("required", xsa.getUse().getValue());
                assertNull(xsa.getFixedValue());
            } else if (name.equals("id")) {
                assertEquals(new QName("http://soapinterop.org/types", "id"),
                             xsa.getQName());
                assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "integer"),
                             xsa.getSchemaTypeName());
                assertEquals("001", xsa.getDefaultValue());
                assertEquals("required", xsa.getUse().getValue());
                assertNull(xsa.getFixedValue());
            } else {
                fail("The name \"" + name + "\" was not expected.");
            }
            assertTrue(s.remove(name));
        }
View Full Code Here

        Set s = new HashSet();
        s.add("units");
        s.add("id");
        s.add("desc");
        for (int i = 0; i < xsoc.getCount(); i++) {
            XmlSchemaAttribute xsa = (XmlSchemaAttribute)xsoc.getItem(i);
            String name = xsa.getName();
            if (name.equals("units")) {
                assertEquals(new QName("http://soapinterop.org/types", "units"),
                             xsa.getQName());
                assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "string"),
                             xsa.getSchemaTypeName());
                assertNull(xsa.getDefaultValue());
                assertEquals("required", xsa.getUse().getValue());
                assertNull(xsa.getFixedValue());
            } else if (name.equals("id")) {
                assertEquals(new QName("http://soapinterop.org/types", "id"),
                             xsa.getQName());
                assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "integer"),
                             xsa.getSchemaTypeName());
                assertEquals("001", xsa.getDefaultValue());
                assertEquals("required", xsa.getUse().getValue());
                assertNull(xsa.getFixedValue());
            } else if (name.equals("desc")) {
                assertEquals(new QName("http://soapinterop.org/types", "desc"),
                             xsa.getQName());
                assertEquals(new QName("http://www.w3.org/2001/XMLSchema", "decimal"),
                             xsa.getSchemaTypeName());
                assertEquals("none", xsa.getUse().getValue());
                assertEquals("1.1", xsa.getFixedValue());
            } else {
                fail("The name \"" + name + "\" was not expected.");
            }
            s.remove(name);
        }
View Full Code Here

   * @param xsdType The type of the attribute
   */
  @SuppressWarnings("unchecked")
  private static void addAttributeToComplexType(XmlSchemaComplexType complexType, String name,
      QName xsdType) {
    XmlSchemaAttribute attr = new XmlSchemaAttribute();
    attr.setName(name);
    attr.setSchemaTypeName(xsdType);
    attr.setUse(new XmlSchemaUse("optional"));
    XmlSchemaAttribute tmpAttr;
    for (Iterator<XmlSchemaAttribute> itr = complexType.getAttributes().getIterator();
             itr.hasNext();) {
      tmpAttr = itr.next();
      if (tmpAttr.getName().equals(attr.getName())) {
        /* current attribute is already set, nothing more to do */
        return;
      }
    }
    complexType.getAttributes().add(attr);
 
View Full Code Here

    XmlSchemaObjectCollection dataSchemaObjects = getSchemaObjectsFromComplexType(dataFieldsType);
   
    int count = dataSchemaObjects.getCount();   
    XmlSchemaObject sequenceDataObject;
    XmlSchemaElement sequenceDataElement;
    XmlSchemaAttribute sequenceDataAttr;
    for (int i = 0; i < count; i++) {
      sequenceDataObject = dataSchemaObjects.getItem(i);
      if (sequenceDataObject instanceof XmlSchemaElement) {
        sequenceDataElement = (XmlSchemaElement) sequenceDataObject;
        if (!(sequenceDataElement.getSchemaType() instanceof XmlSchemaSimpleType)) {
          throw new DataServiceFault(
              "Xmlschema sequence's data fields at the out message of the operation '"
                  + axisOperation.getName() +
                  "' should only contain xml elements with simple types");
        }
        defGroup.addElementEntry(new StaticOutputElement(dataService,
            sequenceDataElement.getName(), sequenceDataElement
                .getName(), sequenceDataElement.getName(),
            DBConstants.DBSFields.COLUMN,
            DBConstants.DBSFields.ELEMENT, namespace,
            sequenceDataElement.getSchemaTypeName(),
            new HashSet<String>(), DBConstants.DataCategory.VALUE,
            DBConstants.ResultTypes.XML, null, ParamValue.PARAM_VALUE_SCALAR));
      } else if (sequenceDataObject instanceof XmlSchemaAttribute) {
        sequenceDataAttr = (XmlSchemaAttribute) sequenceDataObject;
        defGroup.addElementEntry(new StaticOutputElement(dataService,
            sequenceDataAttr.getName(), sequenceDataAttr
                .getName(), sequenceDataAttr.getName(),
            DBConstants.DBSFields.COLUMN,
            DBConstants.DBSFields.ATTRIBUTE, namespace,
            sequenceDataAttr.getSchemaTypeName(),
            new HashSet<String>(), DBConstants.DataCategory.VALUE,
            DBConstants.ResultTypes.XML, null, ParamValue.PARAM_VALUE_SCALAR));
      } else {
        throw new DataServiceFault(
            "Xmlschema sequence at the out message's data field section of the operation '"
View Full Code Here

    protected List<MemberType> processAttributesAsMembers(Iterator attrs) throws Exception {
        QName memName = null;
        List <MemberType>members = new ArrayList<MemberType>();

        while (attrs.hasNext()) {
            XmlSchemaAttribute attribute = (XmlSchemaAttribute)attrs.next();
            CorbaTypeImpl membertype = null;

            if (attribute.getUse().getValue().equals("none")
                || attribute.getUse().getValue().equals(W3CConstants.USE_OPTIONAL)) {               
                CorbaTypeImpl attType = null;
                if (attribute.getSchemaType() != null) {                   
                    attType = convertSchemaToCorbaType(attribute.getSchemaType(),
                                                       attribute.getQName(),
                                              attribute.getSchemaType(), true);
                    if (attType != null) {
                        QName typeName = attType.getQName();
                        attType.setQName(null);          
                        if (!isDuplicate(attType)) {
                            typeMappingType.getStructOrExceptionOrUnion().add(attType);
                        }
                        QName name =  createQNameTargetNamespace(typeName.getLocalPart() + "_nil");
                        membertype = createNillableUnion(name, attribute.getQName(),
                                     createQNameCorbaNamespace(typeName.getLocalPart()));
                    }
                } else {
                    attType = processPrimitiveType(attribute.getSchemaTypeName());
                    QName name =  createQNameTargetNamespace(attType.getQName().getLocalPart() + "_nil");
                    membertype = createNillableUnion(name, attribute.getQName(),
                                     attType.getQName());

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

            if (membertype != null) {
                MemberType member;
                String memberName = attribute.getQName().getLocalPart();

                member = new MemberType();
                member.setName(memberName);
                if (memName != null) {
                    member.setIdltype(memName);
                } else {
                    member.setIdltype(membertype.getQName());
                }
                members.add(member);
            } else {
                String msg = "Unsupported Attribute Found in CORBA Binding Generation:"
                    + attribute.getQName();
                LOG.log(Level.WARNING, msg.toString());           
            }
        }

        return members;
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

        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

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.