Package org.apache.ws.jaxme.xs

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


            XsTGroupRef groupRef = (XsTGroupRef) particle;
            XsQName myName = groupRef.getRef();
            if (myName == null) {
              throw new LocSAXException("Missing 'ref' attribute", groupRef.getLocator());
            }
            XSGroup group = getXSSchema().getGroup(myName);
            if (group == null) {
              throw new LocSAXException("Unknown group: " + myName, getLocator());
            }
            group.validate();
            myComplexType = new XSGroupComplexTypeImpl(this, myXsTComplexType, group);
          } else {
            throw new IllegalStateException("Invalid particle: " + particle.getClass().getName());
          }
        } else {
View Full Code Here


    private final XsTAll all;

    public XSAllComplexTypeImpl(XSType pOwner, XsTComplexType pType, XsTAll pAll) throws SAXException {
      super(pOwner, pType);
      all = pAll;
      XSGroup group = pOwner.getXSSchema().getXSObjectFactory().newXSGroup(pOwner, all);
      group.validate();
      XSParticleImpl particle = new XSParticleImpl(group);
      particle.setMaxOccurs(pAll.getMaxOccurs());
      particle.setMinOccurs(pAll.getMinOccurs());
      if (group.getParticles().length == 0) {
        setParticle(XsComplexContentType.EMPTY, particle);
      } else {
        setParticle(pType.isMixed() ? XsComplexContentType.MIXED : XsComplexContentType.ELEMENT_ONLY, particle);
      }
    }
View Full Code Here

    protected XsEComplexContent getComplexContent() {
      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);
      } else if (pParticle instanceof XsESequence) {
        XsESequence sequence = (XsESequence) pParticle;
        result = factory.newXSGroup(myOwner, sequence);
      } else if (pParticle instanceof XsTAll) {
        XsTAll all = (XsTAll) pParticle;
        result = factory.newXSGroup(myOwner, all);
      } else if (pParticle instanceof XsTGroupRef) {
        XsTGroupRef groupRef = (XsTGroupRef) pParticle;
        result = factory.newXSGroup(myOwner, groupRef);
      } else {
        throw new IllegalStateException("Unknown TypeDefParticle type: " + pParticle.getClass().getName());
      }
      result.validate();
      return result;
    }
View Full Code Here

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

      setParticle(pType.isMixed() ? XsComplexContentType.MIXED : XsComplexContentType.EMPTY, null);
    }
    public XSSequenceComplexTypeImpl(XSType pOwner, XsTComplexType pType, XsESequence pSequence) throws SAXException {
      super(pOwner, pType);
      sequence = pSequence;
      XSGroup group = pOwner.getXSSchema().getXSObjectFactory().newXSGroup(pOwner, sequence);
      group.validate();
      XSParticleImpl particle = new XSParticleImpl(group);
      particle.setMaxOccurs(pSequence.getMaxOccurs());
      particle.setMinOccurs(pSequence.getMinOccurs());
      if (group.getParticles().length == 0) {
        setParticle(XsComplexContentType.EMPTY, particle);
      } else {
        setParticle(pType.isMixed() ? XsComplexContentType.MIXED : XsComplexContentType.ELEMENT_ONLY, particle);
      }
    }
View Full Code Here

    private final XsEChoice choice;

    public XSChoiceComplexTypeImpl(XSType pOwner, XsTComplexType pType, XsEChoice pChoice) throws SAXException {
      super(pOwner, pType);
      choice = pChoice;
      XSGroup group = pOwner.getXSSchema().getXSObjectFactory().newXSGroup(pOwner, choice);
      group.validate();
      XSParticleImpl particle = new XSParticleImpl(group);
      particle.setMaxOccurs(pChoice.getMaxOccurs());
      particle.setMinOccurs(pChoice.getMinOccurs());     
      if (group.getParticles().length == 0) {
        throw new LocSAXException("The complex type must not have an empty element group, as it is a choice.",
                                     choice.getLocator());
      } else {
        setParticle(pType.isMixed() ? XsComplexContentType.MIXED : XsComplexContentType.ELEMENT_ONLY, particle);
      }
View Full Code Here

    XsAGOccurs occurs;
    XSParticleImpl p;
    if (pParticle instanceof XsTAll) {
      XsTAll all = (XsTAll) pParticle;
      occurs = all;
      XSGroup group = getXSSchema().getXSObjectFactory().newXSGroup(this, all);
      group.validate();
      p = new XSParticleImpl(group);
    } else if (pParticle instanceof XsTNestedParticle) {
      addParticle(pModelGroup, (XsTNestedParticle) pParticle);
      return;
    } else {
View Full Code Here

      wildcard.validate();
      p = new XSParticleImpl(wildcard);
    } else if (pParticle instanceof XsEChoice) {
      XsEChoice choice = (XsEChoice) pParticle;
      occurs = choice;
      XSGroup group = getXSSchema().getXSObjectFactory().newXSGroup(this, choice);
      group.validate();
      p = new XSParticleImpl(group);
    } else if (pParticle instanceof XsESequence) {
      XsESequence sequence = (XsESequence) pParticle;
      occurs = sequence;
      XSGroup group = getXSSchema().getXSObjectFactory().newXSGroup(this, sequence);
      group.validate();
      p = new XSParticleImpl(group);
    } else {
      XsTGroupRef groupRef = null;
      XsTLocalElement localElement = null;
      if (pParticle instanceof XsTGroupRef) {
        groupRef = (XsTGroupRef) pParticle;
      } else if (pParticle instanceof XsTLocalElement) {
        localElement = (XsTLocalElement) pParticle;
        // May be the referenced element is the head of a substitution group
        XsQName ref = localElement.getRef();
        if (ref != null) {
          XSElement referencedElement = getXSSchema().getElement(ref);
          if (referencedElement == null) {
            throw new LocSAXException("The referenced element " + ref + " is undefined.", localElement.getLocator());
          }
          XSGroup substitutedGroup = referencedElement.getSubstitutionGroup();
          if (substitutedGroup != null  &&  substitutedGroup != this) {
            XsObject parent = localElement.getParentObject();
            XsTGroupRefImpl groupRefImpl = (XsTGroupRefImpl) localElement.getObjectFactory().newXsTGroupRef(parent);
            groupRefImpl.setRef(substitutedGroup.getName());
            int maxOccurs = localElement.getMaxOccurs();
            if (maxOccurs == -1) {
              groupRefImpl.setMaxOccurs("unbounded");
            } else {
              groupRefImpl.setMaxOccurs(Integer.toString(maxOccurs));
            }
            groupRefImpl.setMinOccurs(localElement.getMinOccurs());
            groupRef = groupRefImpl;
          }
        }
      } else {
        throw new IllegalStateException("Unknown particle type: " + pParticle.getClass().getName());
      }
      if (groupRef == null) {
        occurs = localElement;
        XSElement element = getXSSchema().getXSObjectFactory().newXSElement(this, localElement);
        element.validate();
        p = new XSParticleImpl(element);
      } else {
        occurs = groupRef;
        XSGroup group = getXSSchema().getXSObjectFactory().newXSGroup(this, groupRef);
        group.validate();
        p = new XSParticleImpl(group);
      }
    }
    pModelGroup.addParticle(p);
    p.setMaxOccurs(occurs.getMaxOccurs());
View Full Code Here

    if (modelGroup == null) {
      XsQName myName = getName();
      if (myName == null) {
        throw new NullPointerException("Missing group name");
      }
      XSGroup group = getXSSchema().getGroup(myName);
      if (group == null) {
        throw new LocSAXException("Unknown group: " + myName, getLocator());
      }
      modelGroup = group;
    }
View Full Code Here

  public GroupSG getGroup(SchemaSG pController, XsQName pName) throws SAXException {
    GroupSG groupSG = (GroupSG) groupsByName.get(pName);
    if (groupSG != null) {
      return groupSG;
    }
    XSGroup group = getXSSchema().getGroup(pName);
    if (group == null) {
      return null;
    }
    groupSG = pController.getFactory().getGroupSG(group);
    groupsByName.put(pName, groupSG);
View Full Code Here

TOP

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

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.