Package org.apache.ws.jaxme.xs

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


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


        assertEquals(XSID.getInstance(), idAttr.getType());
        assertTrue(idAttr.isOptional());
        XSElement[] elements = schema.getElements();
        assertEquals(1, elements.length);
        XSElement rifElem = elements[0];
        XSComplexType ct = assertComplexType(rifElem.getType());
        XSAttributable[] rifAttrs = ct.getAttributes();
        assertEquals(1, rifAttrs.length);
        XSAttribute idRef = (XSAttribute) rifAttrs[0];
        assertFalse(idRef.equals(idAttr));
        assertEquals(new XsQName(uri, "id"), idAttr.getName());
        assertEquals(XSID.getInstance(), idAttr.getType());
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

    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

    JAXBParser parser = newJAXBParser();
    InputSource isource = new InputSource(new StringReader(schemaSource));
    isource.setSystemId("testJAXBProperty1.xsd");
    JAXBSchema schema = (JAXBSchema) parser.parse(isource);
    XSType type = schema.getType(new XsQName((String) null, "ct"));
    XSComplexType complexType = assertComplexType(type);
    XSAttributable[] attributes = complexType.getAttributes();
    assertNotNull(attributes);
    assertEquals(1, attributes.length);
    JAXBAttribute a1 = (JAXBAttribute) attributes[0];
    assertEquals(XSDateTime.getInstance(), a1.getType());
    JAXBProperty ap1 = a1.getJAXBProperty();
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

  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

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.