Package org.apache.ws.jaxme.xs

Examples of org.apache.ws.jaxme.xs.XSType


                          XsEUnion pBaseUnion) throws SAXException {
    XsQName[] names = pBaseUnion.getMemberTypes();
    if (names != null) {
      for (int i = 0;  i < names.length;  i++) {
        XsQName name = names[i];
        XSType type = pOwner.getXSSchema().getType(name);
        if (type == null) {
          throw new LocSAXException("Unknown member type: " + name, pBaseUnion.getLocator());
        }
        type.validate();
        if (!type.isSimple()) {
          throw new LocSAXException("The member type " + name + " is complex.",
                                       pBaseUnion.getLocator());
        }
        memberTypes.add(type);
      }
    }
    XsTLocalSimpleType[] simpleTypes = pBaseUnion.getSimpleTypes();
    if (simpleTypes != null) {
      for (int i = 0;  i < simpleTypes.length;  i++) {
        XsTLocalSimpleType localSimpleType = simpleTypes[i];
        XSType type = pOwner.getXSSchema().getXSObjectFactory().newXSType(pOwner, localSimpleType);
        type.validate();
        memberTypes.add(type);
      }
    }
    if (memberTypes.size() == 0) {
      throw new LocSAXException("Neither the 'memberTypes' attribute nor the 'simpleType' child elements did define a member type.",
View Full Code Here


    }

    XSSchema schema = getXSSchema();
    XSObjectFactory factory = schema.getXSObjectFactory();

    XSType myType;
    if (isReference()) {
      XSElement element = schema.getElement(getName());
      if (element == null) {
        throw new LocSAXException("Invalid element reference: " + getName() + " is not defined.",
                                     getLocator());
      }
      element.validate();
      isNillable = element.isNillable();   
      myType = element.getType();
     
    } else {
      XsTElement element = getXsTElement();
      if (isInnerSimpleType()) {
        myType = factory.newXSType(this, element.getSimpleType());
      } else if (isInnerComplexType()) {
        myType = factory.newXSType(this, element.getComplexType());
      } else {
        XsQName typeName = element.getType();
        if (typeName == null) {
          throw new LocSAXException("Invalid element: Either of its 'type' or 'ref' attributes or its 'simpleType' or 'complexType' children must be set.",
                                       getLocator());
        }
        myType = schema.getType(typeName);
        if (myType == null) {
          throw new LocSAXException("Invalid element: The type " + typeName + " is not defined.",
                                       getLocator());
        }
      }
    }
    this.type = myType;
   

    myType.validate();
    validateAllIn( annotations );
    validateAllIn( identityConstraints );
    validateAllIn( keyReferences );
  }
View Full Code Here

  public GlobalContext(XsQName pQName, XSObject pJAXBClassOwner,
             String pPrefix, String pSuffix, SchemaSG pSchemaSG)
      throws SAXException {
    Locator locator;
    if (pJAXBClassOwner instanceof XSType) {
      XSType type = (XSType) pJAXBClassOwner;
      if (type.isBuiltin()) {
        locator = null;
      } else {
        locator = type.getLocator();
      }
    } else {
      locator = pJAXBClassOwner.getLocator();
    }
View Full Code Here

    super(pSchema.getFactory(), pSchema, pAttribute);
    xsAttribute = pAttribute;
    xsWildcard = null;
    isRequired = !pAttribute.isOptional();
    name = pAttribute.getName();
        XSType type = pAttribute.getType();
        if (type == null) {
            throw new IllegalStateException("The attribute type must not be null.");
        }
        if (type.isGlobal()) {
          typeSG = getFactory().getTypeSG(type);
            if (typeSG == null) {
              throw new IllegalStateException("Unknown global type: " + type.getName());
            }
        } else {
          typeSG = getFactory().getTypeSG(pAttribute.getType(), pClassContext, name);
        }
    isWildcard = false;
View Full Code Here

    super(pFactory, pSchema, pType);
    name = pName;
    xsType = pType;
    if (pType.isSimple()) {
      if (pType.getSimpleType().isRestriction()) {
        XSType restrictedXsType = pType.getSimpleType().getRestrictedType();
        restrictedType = getReferencedType(pFactory, pClassContext, pType, restrictedXsType);
        extendedType = null;
      } else {
        restrictedType = extendedType = null;
      }
View Full Code Here

      }
    }

    if (theChild == null) {
      // We have to create a new attribute matching the column
      XSType xsType;
      if (pColumn.isBinaryColumn()) {
        xsType = XSBase64Binary.getInstance();
      } else if (pColumn.isStringColumn()) {
        xsType = XSString.getInstance();
      } else {
View Full Code Here

  public TypeSG getType(SchemaSG pController, XsQName pName) throws SAXException {
    TypeSG typeSG = (TypeSG) typesByName.get(pName);
    if (typeSG != null) {
      return typeSG;
    }
    XSType type = getXSSchema().getType(pName);
    if (type == null) {
      return null;
    }
    typeSG = pController.getFactory().getTypeSG(type);
    typesByName.put(pName, typeSG);
View Full Code Here

  /** <p>Creates a new instance of JAXBSimpleContentSG.java.</p>
   */
  protected JAXBSimpleContentTypeSG(ComplexTypeSG pComplexTypeSG, XSType pType) throws SAXException {
    xsType = pType;
    typeSG = pComplexTypeSG.getTypeSG();
    XSType theSimpleType = pType.getComplexType().getSimpleContent().getType();
    contentTypeSG = typeSG.getFactory().getTypeSG(theSimpleType, pComplexTypeSG.getClassContext(), null);
  }
View Full Code Here

            + "</xs:schema>";

        XSSchema schema = parse(schemaSpec, "jira44.xsd");
        XSType[] types = schema.getTypes();
        assertEquals(3, types.length);
        XSType threeOrFourType = types[0];
        XSSimpleType threeOrFourSimpleType = assertSimpleType(threeOrFourType);
        XSType restrictedType = assertRestriction(threeOrFourSimpleType);
        XSEnumeration[] threeOrFourTypeEnums = threeOrFourSimpleType.getEnumerations();
        assertEquals(2, threeOrFourTypeEnums.length);
        assertEquals("3", threeOrFourTypeEnums[0].getValue());
        assertEquals("4", threeOrFourTypeEnums[1].getValue());
        assertEquals(XSString.getInstance(), restrictedType);
        XSType outerType1 = types[1];
        assertEquals(new XsQName((XsAnyURI) null, "outerType1"), outerType1.getName());
        XSComplexType outerType1complexType = assertComplexType(outerType1);
        XSSimpleContentType outerType1simpleContentType = assertSimpleContent(outerType1complexType);
        XSType outerType1contentType = outerType1simpleContentType.getType();
        assertEquals(threeOrFourType, outerType1contentType);
        XSType outerType2 = types[2];
        assertEquals(new XsQName((XsAnyURI) null, "outerType2"), outerType2.getName());
        XSComplexType outerType2complexType = assertComplexType(outerType2);
        XSSimpleContentType outerType2simpleContentType = assertSimpleContent(outerType2complexType);
        XSType outerType2contentType = outerType2simpleContentType.getType();
        assertEquals(threeOrFourType, assertRestriction(outerType2contentType.getSimpleType()));
        XSEnumeration[] outerType2Enums = outerType2contentType.getSimpleType().getEnumerations();
        assertEquals(1, outerType2Enums.length);
        assertEquals("4", outerType2Enums[0].getValue());
    }
View Full Code Here

      return complexContent;
    }

    protected XSGroup getGroupByParticle(XsTTypeDefParticle pParticle) throws SAXException {
      XSGroup result;
      XSType myOwner = getOwner();
      XSObjectFactory factory = myOwner.getXSSchema().getXSObjectFactory();
      if (pParticle == null) {
        return null;
      } else if (pParticle instanceof XsEChoice) {
        XsEChoice choice = (XsEChoice) pParticle;
        result = factory.newXSGroup(myOwner, choice);
View Full Code Here

TOP

Related Classes of org.apache.ws.jaxme.xs.XSType

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.