Package org.apache.ws.jaxme.xs

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


      assertTrue(idAttr.isOptional());
      XSElement[] elements = schema.getElements();
      assertEquals(1, elements.length);
      XSElement rifElem = elements[0];
      assertFalse(rifElem.getType().isSimple());
      XSComplexType ct = rifElem.getType().getComplexType();
      XSAttributable[] rifAttrs = ct.getAttributes();
      assertEquals(1, rifAttrs.length);
      XSAttribute idRef = (XSAttribute) rifAttrs[0];
      assertTrue(idRef instanceof JAXBAttribute);
      assertFalse(idRef.equals(idAttr));
      assertEquals(new XsQName(uri, "id"), idAttr.getName());
View Full Code Here


    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);
View Full Code Here

    return result;
  }

  public XSComplexType getComplexType() throws SAXException {
    validate();
    XSComplexType result = complexType;
    if (result == null) {
      if (getName() == null) {
        throw new IllegalStateException("This is a simple type.");
      } else {
        throw new IllegalStateException("The type " + getName() + " is simple.");
View Full Code Here

        if (extendedType.isSimple()) {
          simpleContentType = getOwner().getXSSchema().getXSObjectFactory().newXSSimpleContentType(pOwner,
                                                                                     extendedType, extension);
          inheritedAttributes = new XSAttributable[0];
        } else {
          XSComplexType myComplexType = extendedType.getComplexType();
          if (!myComplexType.hasSimpleContent()) {
            throw new LocSAXException("Invalid 'extension': The base type " + extendedTypesName +
                                         " is neither a simple type nor a complex type with simple content.",
                                         extension.getLocator());
          }
          simpleContentType = myComplexType.getSimpleContent();
          inheritedAttributes = myComplexType.getAttributes();
        }
        XSAttributable[] myAttributes = XSAttributeGroupImpl.getAttributes(XSTypeImpl.this, extension);
        attributes = new XSAttributable[inheritedAttributes.length + myAttributes.length];
        System.arraycopy(inheritedAttributes, 0, attributes, 0, inheritedAttributes.length);
        System.arraycopy(myAttributes, 0, attributes, inheritedAttributes.length, myAttributes.length);
View Full Code Here

          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();
        XSGroup group = getGroupByParticle(particle);
        XsComplexContentType groupType = getContentTypeByParticle(particle, group);

        if (XsComplexContentType.EMPTY.equals(groupType)) {
          if (type == XSAnyType.getInstance()) {
            complexContentType = null;
            complexContentParticle = null;
          } else {
            complexContentType = extendedComplexType.getComplexContentType();
            complexContentParticle = extendedComplexType.getParticle();
          }
        } else if (extendedComplexType.isEmpty()) {
          complexContentType = groupType;
          complexContentParticle = new XSParticleImpl(group);
        } else {
          XSGroup sequenceGroup = new ExtensionGroup(pOwner, new XSParticle[]{extendedComplexType.getParticle(), new XSParticleImpl(group)});
          complexContentParticle = new XSParticleImpl(sequenceGroup);
          complexContentType = groupType;
        }

        XSAttributable[] inheritedAttributes = extendedComplexType.getAttributes();
        XSAttributable[] myAttributes = XSAttributeGroupImpl.getAttributes(XSTypeImpl.this, extension);
        attributes = new XSAttributable[inheritedAttributes.length + myAttributes.length];
        System.arraycopy(inheritedAttributes, 0, attributes, 0, inheritedAttributes.length);
        System.arraycopy(myAttributes, 0, attributes, inheritedAttributes.length, myAttributes.length);
        extendedType = type;
View Full Code Here

    return parser;
  }

  protected XSComplexType assertComplexType(XSType pType) throws SAXException {
    assertTrue(!pType.isSimple());
    XSComplexType result = pType.getComplexType();
    assertNotNull(result);
    boolean haveException = false;
    try {
      pType.getSimpleType();
    } catch (IllegalStateException e) {
View Full Code Here

  protected JAXBComplexTypeSG(TypeSG pTypeSG, XSType pType) throws SAXException {
    final String mName = "<init>(XSType)";
    log.finest(mName, "->", new Object[]{pTypeSG, pType});
    typeSG = pTypeSG;
    xsType = pType;
    XSComplexType complexType= pType.getComplexType();
    hasSimpleContent = complexType.hasSimpleContent();
    classContext = new GlobalContext(pTypeSG.getName(), pType, null, "Type", pTypeSG.getSchema());
    log.finest(mName, "<-", classContext);
  }
View Full Code Here

  protected JAXBComplexTypeSG(TypeSG pTypeSG, XSType pType, Context pContext) throws SAXException {
    final String mName = "<init>(XSType)";
    log.finest(mName, "->", new Object[]{pTypeSG, pType, pContext});
    typeSG = pTypeSG;
    xsType = pType;
    XSComplexType complexType= pType.getComplexType();
    hasSimpleContent = complexType.hasSimpleContent();
    classContext = new LocalContext(pContext, pTypeSG.getName().getLocalName(), pType, null, "Type",
                                    pTypeSG.getSchema());
    log.finest(mName, "<-", classContext);
  }
View Full Code Here

    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());
    }
    if (myComplexType.isExtension()) {
      XSType extendedType = myComplexType.getSimpleContent().getType();
      extendedType.validate();
      simpleType = extendedType.getSimpleType();
    } else {
      XsTLocalSimpleType localSimpleType = pRestriction.getSimpleType();
      XSObjectFactory factory = pParent.getXSSchema().getXSObjectFactory();
      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);
View Full Code Here

    return result;
  }

  public XSComplexType getComplexType() throws SAXException {
    validate();
    XSComplexType result = complexType;
    if (result == null) {
      if (getName() == null) {
        throw new IllegalStateException("This is a simple type.");
      } else {
        throw new IllegalStateException("The type " + getName() + " is simple.");
View Full Code Here

TOP

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

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.