Package org.apache.ws.jaxme.xs

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


    XSType[] types = schema.getTypes();
    assertEquals(2, types.length);
    XSType a = types[0];
    assertEquals(new XsQName((String) null, "a"), a.getName());
    XSComplexType aComplexType = assertComplexType(a);
    XSAttributable[] aAttributes = aComplexType.getAttributes();
    assertEquals(1, aAttributes.length);
    XSAttribute aa1 = (XSAttribute) aAttributes[0];

    XSType b = types[1];
    assertEquals(new XsQName((String) null, "b"), b.getName());
    XSComplexType bComplexType = assertComplexType(b);
    assertTrue(bComplexType.isExtension());
    assertEquals(bComplexType.getExtendedType(), a);
    XSAttributable[] bAttributes = bComplexType.getAttributes();
    assertEquals(2, bAttributes.length);
    assertEquals(aa1, bAttributes[0]);
    XSAttribute ba1 = (XSAttribute) bAttributes[1];
    assertEquals(new XsQName((String) null, "ba1"), ba1.getName());
  }
View Full Code Here


        assertEquals(2, elements.length);
        assertEquals(new XsQName("http://ws.apache.org/jaxme/test/recursion", "Attribute"), elements[0].getName());
        assertTrue(elements[0].isGlobal());
        assertEquals(new XsQName("http://ws.apache.org/jaxme/test/recursion", "AttributeList"), elements[1].getName());
        assertTrue(elements[1].isGlobal());
        XSComplexType complexType = assertComplexType(elements[1].getType());
        XSParticle particle = assertComplexContent(complexType);
        XSGroup group = assertGroup(particle);
        XSParticle[] particles = group.getParticles();
        assertEquals(2, particles.length);
        assertEquals(1, particles[0].getMinOccurs());
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

        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 myComplexType = type.getComplexType();
        if (myComplexType.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)) {
          complexContentType = myComplexType.getComplexContentType();
          complexContentParticle = myComplexType.getParticle();
        } else if (myComplexType.isEmpty()) {
          complexContentType = groupType;
          complexContentParticle = new XSParticleImpl(group);
        } else {
          XSGroup sequenceGroup = new ExtensionGroup(pOwner, new XSParticle[]{myComplexType.getParticle(), new XSParticleImpl(group)});
          complexContentParticle = new XSParticleImpl(sequenceGroup);
          complexContentType = groupType;
        }

        XSAttributable[] 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);
        extendedType = type;
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();
    String suffix = pTypeSG.isGlobalType() ? null : "Type";
    classContext = new GlobalContext(pTypeSG.getName(), pType, null, suffix, 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

      {
         processSimpleType(element, type, null, declareNs);
      }
      else
      {
         XSComplexType complexType = type.getComplexType();
         processComplexType(element, complexType, maxOccurs, declareNs);
      }
   }
View Full Code Here

         XSSimpleType simpleType = type.getSimpleType();
         processSimpleType(element, simpleType, null);
      }
      else
      {
         XSComplexType complexType = type.getComplexType();
         processComplexType(element, complexType, attrs, maxOccurs);
      }
   }
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.