Package org.apache.ws.jaxme.xs

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


    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


    XsQName myName = pRestriction.getBase();
    if (myName == null) {
      throw new LocSAXException("Invalid 'restriction': Missing 'base' attribute.",
                                   pRestriction.getLocator());
    }
    XSType type = getXSSchema().getType(myName);
    if (type == null) {
      throw new LocSAXException("Invalid 'restriction': Unknown 'base' type " + myName,
                                   pRestriction.getLocator());
    }
    type.validate();
    if (type.isSimple()) {
      throw new LocSAXException("The 'base' type " + myName + " of 'simpleContent/restriction' is simple." +
                                   " It ought to be a complex type with simple content: ",
                                   pRestriction.getLocator());
    }
    XSComplexType myComplexType = type.getComplexType();
    if (!myComplexType.hasSimpleContent()) {
      throw new LocSAXException("The 'base' type " + myName + " of 'simpleContent/restriction' is complex," +
                                   " but doesn't have simple content: ", pRestriction.getLocator());
    }
    XSObjectFactory factory = pParent.getXSSchema().getXSObjectFactory();
    if (myComplexType.isExtension()) {
      XSType extendedType = myComplexType.getSimpleContent().getType();
      extendedType.validate();
      XSSimpleType extendedSimpleType = extendedType.getSimpleType();
 
      XSSimpleType mySimpleType;
      if (extendedSimpleType.isAtomic()) {
        mySimpleType = factory.newXSAtomicType(this, extendedType, pRestriction);
      } else if (extendedSimpleType.isList()) {
        mySimpleType = factory.newXSListType(this, extendedType, pRestriction);
      } else if (extendedSimpleType.isUnion()) {
        mySimpleType = factory.newXSUnionType(this, extendedType, pRestriction);
      } else {
        throw new LocSAXException("Unknown restriction type: " + extendedType,
                              pRestriction.getLocator());
      }

      simpleType = mySimpleType;
      //was: setSimpleType( extendedType.getSimpleType() );
    } else {
      XsTLocalSimpleType localSimpleType = pRestriction.getSimpleType();
      XSType restrictedType;
      if (localSimpleType != null) {
        restrictedType = factory.newXSType(this, localSimpleType);
      } else {
        restrictedType = myComplexType.getSimpleContent().getType();
      }
      restrictedType.validate();
      XSSimpleType restrictedSimpleType = restrictedType.getSimpleType();
      if (restrictedSimpleType.isAtomic()) {
        simpleType = factory.newXSAtomicType(this, restrictedType, pRestriction);
      } else if (restrictedSimpleType.isList()) {
        simpleType = factory.newXSListType(this, restrictedType, pRestriction);
      } else if (restrictedSimpleType.isUnion()) {
View Full Code Here

            if (restriction == null) {
              throw new LocSAXException("Either of the 'list', 'union', or 'restriction' child elements must be set.",
                  myXsTSimpleType.getLocator());
            }
            XsQName myName = restriction.getBase();
            XSType restrictedType;         
            if (myName == null) {
              XsTLocalSimpleType baseType = restriction.getSimpleType();
              if (baseType == null) {
                throw new LocSAXException("Neither the 'base' attribute nor an inner 'simpleType' element are present",
                    restriction.getLocator());
              } else {
                restrictedType = getXSSchema().getXSObjectFactory().newXSType(this, baseType);
              }
            } else {
              restrictedType = getXSSchema().getType(myName);
              if (restrictedType == null) {
                throw new LocSAXException("Unknown base type: " + myName,
                    restriction.getLocator());
              }
            }
            restrictedType.validate();
            if (!restrictedType.isSimple()) {
              throw new LocSAXException("The restricted type " + myName + " is complex.",
                  restriction.getLocator());
            }
            XSSimpleType baseType = restrictedType.getSimpleType();
            if (baseType.isAtomic()) {
              mySimpleType = getXSSchema().getXSObjectFactory().newXSAtomicType(this, restrictedType, restriction);
            } else if (baseType.isList()) {
              mySimpleType = getXSSchema().getXSObjectFactory().newXSListType(this, restrictedType, restriction);
            } else if (baseType.isUnion()) {
View Full Code Here

                                     restriction.getLocator());
        }
        restrictedType.validate();
        extendedType = null;
        XSObjectFactory factory = pOwner.getXSSchema().getXSObjectFactory();
        XSType contentType = factory.newXSType(pOwner, restriction);
        simpleContentType = factory.newXSSimpleContentType(pOwner, contentType, restriction);
        attributes = XSAttributeGroupImpl.getAttributes(XSTypeImpl.this, restriction);
      } else {
        XsQName extendedTypesName = extension.getBase();
        if (extendedTypesName == null) {
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

        }
        XsQName base = restriction.getBase();
        if (base == null) {
          throw new LocSAXException("Invalid 'restriction': Missing 'base' attribute", getLocator());
        }
        XSType type = getXSSchema().getType(base);
        if (type == null) {
          throw new LocSAXException("Invalid 'restriction': Unknown base type " + base, getLocator());
        }
        if (type.isSimple()) {
          throw new LocSAXException("Invalid 'restriction': The base type " + getName() + " is simple.", getLocator());
        }
        XsTTypeDefParticle particle = restriction.getTypeDefParticle();

        XSGroup group = getGroupByParticle(particle);
        if (group == null) {
          // TODO: Restriction of the ur-type
          complexContentParticle = null;
        } else {
          complexContentParticle = new XSParticleImpl(group);
        }
        complexContentType = getContentTypeByParticle(particle, group);
        attributes = XSAttributeGroupImpl.getAttributes(XSTypeImpl.this, restriction);
        restrictedType = type;
      } else {
        XsQName base = extension.getBase();
        if (base == null) {
          throw new LocSAXException("Invalid 'extension': Missing 'base' attribute", getLocator());
        }
        XSType type = getXSSchema().getType(base);
        if (type == null) {
          throw new LocSAXException("Invalid 'extension': Unknown base type " + base, getLocator());
        }
        if (type.isSimple()) {
          throw new LocSAXException("Invalid 'extension': The base type " + base + " is simple.", getLocator());
        }
        XSComplexType extendedComplexType = type.getComplexType();
        if (extendedComplexType.hasSimpleContent()) {
          throw new LocSAXException("Invalid 'extension': The base type " + base + " has simple content.",
                                       getLocator());
        }
        XsTTypeDefParticle particle = extension.getTypeDefParticle();
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 XSType[] getBuiltinTypes() {
    return BUILTIN_TYPES;
  }

  public XSType getType(XsQName pName) {
    XSType result = (XSType) types.get(pName);
    if (result == null) {
      result = (XSType) builtinTypes.get(pName);
    }
    return result;
  }
View Full Code Here

      XsTLocalSimpleType simpleType = pBaseList.getSimpleType();
      if (simpleType == null) {
        throw new LocSAXException("You must either set the 'itemType' attribute or add a 'simpleType' element.",
                                   pBaseList.getLocator());
      }
      XSType type = pOwner.getXSSchema().getXSObjectFactory().newXSType(pOwner, simpleType);
      type.validate();
      itemType = type;
    } else {
      XSType type = pOwner.getXSSchema().getType(itemTypeName);
      if (type == null) {
        throw new LocSAXException("Unknown item type: " + itemTypeName, pBaseList.getLocator());
      }
      type.validate();
      if (!type.isSimple()) {
        throw new LocSAXException("The item type " + itemTypeName + " is complex.",
                                     pBaseList.getLocator());
      }
      itemType = type;
    }
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

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.