Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSObjectList


        // (3) add default attrs (FIXED and NOT_FIXED)
        //
        if (DEBUG) {
            System.out.println("==>addDefaultAttributes: " + element);
        }
        XSObjectList attrUses = attrGrp.getAttributeUses();
        int useCount = attrUses.getLength();
        XSAttributeUseImpl currUse;
        XSAttributeDecl currDecl;
        short constType;
        ValidatedInfo defaultValue;
        boolean isSpecified;
        QName attName;
        // for each attribute use
        for (int i = 0; i < useCount; i++) {

            currUse = (XSAttributeUseImpl) attrUses.item(i);
            currDecl = currUse.fAttrDecl;
            // get value constraint
            constType = currUse.fConstraintType;
            defaultValue = currUse.fDefault;
            if (constType == XSConstants.VC_NONE) {
View Full Code Here


            particle.fType = XSParticleDecl.PARTICLE_MODELGROUP;
            particle.fValue = group.fModelGroup;
            particle.fMinOccurs = minOccurs;
            particle.fMaxOccurs = maxOccurs;
            if (refAttr != null) {
                XSObjectList annotations;
                if (annotation != null) {
                    annotations = new XSObjectListImpl();
                    ((XSObjectListImpl) annotations).add(annotation);
                } else {
                    annotations = XSObjectListImpl.EMPTY_LIST;
View Full Code Here

            if (strNameAttr != null) {
                group.fName = strNameAttr;
                group.fTargetNamespace = schemaDoc.fTargetNamespace;
                if (particle != null)
                    group.fModelGroup = (XSModelGroupImpl)particle.fValue;
                XSObjectList annotations;
                if (annotation != null) {
                    annotations = new XSObjectListImpl();
                    ((XSObjectListImpl) annotations).add(annotation);
                } else {
                    annotations = XSObjectListImpl.EMPTY_LIST;
View Full Code Here

            }
        }
        // get types from "memberTypes" attribute
        Vector dTValidators = null;
        XSSimpleType dv = null;
        XSObjectList dvs;
        if (union && memberTypes != null && memberTypes.size() > 0) {
            int size = memberTypes.size();
            dTValidators = new Vector(size, 2);
            // for each qname in the list
            for (int i = 0; i < size; i++) {
                // get the type decl
                dv = findDTValidator(child, name, (QName)memberTypes.elementAt(i),
                        XSConstants.DERIVATION_UNION, schemaDoc);
                if (dv != null) {
                    // if it's a union, expand it
                    if (dv.getVariety() == XSSimpleType.VARIETY_UNION) {
                        dvs = dv.getMemberTypes();
                        for (int j = 0; j < dvs.getLength(); j++)
                            dTValidators.addElement(dvs.item(j));
                    } else {
                        dTValidators.addElement(dv);
                    }
                }
            }
        }
        // when there is an error finding the base type of a restriction
        // we use anySimpleType as the base, then we should skip the facets,
        // because anySimpleType doesn't recognize any facet.
        boolean skipFacets = false;
        // check if there is a child "simpleType"
        if (content != null && DOMUtil.getLocalName(content).equals(SchemaSymbols.ELT_SIMPLETYPE)) {
            if (restriction || list) {
                // it's an error for both "base" and "simpleType" to appear
                if (baseTypeName != null) {
                    reportSchemaError(list ? "src-simple-type.3.a" : "src-simple-type.2.a", null, content);
                }
                else {
                    // traver this child to get the base type
                    baseValidator = traverseLocal(content, schemaDoc, grammar);
                }
                // get the next element
                content = DOMUtil.getNextSiblingElement(content);
            }
            else if (union) {
                if (dTValidators == null) {
                    dTValidators = new Vector(2, 2);
                }
                do {
                    // traver this child to get the member type
                    dv = traverseLocal(content, schemaDoc, grammar);
                    if (dv != null) {
                        // if it's a union, expand it
                        if (dv.getVariety() == XSSimpleType.VARIETY_UNION) {
                            dvs = dv.getMemberTypes();
                            for (int j = 0; j < dvs.getLength(); j++)
                                dTValidators.addElement(dvs.item(j));
                        } else {
                            dTValidators.addElement(dv);
                        }
                    }
                    // get the next element
View Full Code Here

            String typeName,
            boolean extension,
            Element elem)
    throws ComplexTypeRecoverableError {
       
        XSObjectList attrUseS = fromAttrGrp.getAttributeUses();
        XSAttributeUseImpl  duplicateAttrUse =  null, oneAttrUse = null;
        int attrCount = attrUseS.getLength();
        for (int i=0; i<attrCount; i++) {
            oneAttrUse = (XSAttributeUseImpl)attrUseS.item(i);
            XSAttributeUse existingAttrUse = toAttrGrp.getAttributeUse(oneAttrUse.fAttrDecl.getNamespace(),
                    oneAttrUse.fAttrDecl.getName());
            if (existingAttrUse == null) {
               
                String idName = toAttrGrp.addAttributeUse(oneAttrUse);
View Full Code Here

    private boolean isListDatatype(XSSimpleType validator) {
        if (validator.getVariety() == XSSimpleType.VARIETY_LIST)
            return true;
       
        if (validator.getVariety() == XSSimpleType.VARIETY_UNION) {
            XSObjectList temp = validator.getMemberTypes();
            for (int i = 0; i < temp.getLength(); i++) {
                if (((XSSimpleType)temp.item(i)).getVariety() == XSSimpleType.VARIETY_LIST) {
                    return true;
                }
            }
        }
       
View Full Code Here

            String text = DOMUtil.getSyntheticAnnotation(elmNode);
            if (text != null) {
                annotation = traverseSyntheticAnnotation(elmNode, text, attrValues, false, schemaDoc);
            }
        }
        XSObjectList annotations;
        if (annotation != null) {
            annotations = new XSObjectListImpl();
            ((XSObjectListImpl) annotations).add(annotation);
        } else {
            annotations = XSObjectListImpl.EMPTY_LIST;
View Full Code Here

    if( variety == XSSimpleType.VARIETY_LIST ){
        // 'Item Type definition' property of List Simple Type Definition Schema Component.
        XSSimpleType listDecl = (XSSimpleType)simpleType.getItemType();
    }else if(variety == XSSimpleType.VARIETY_UNION ){
        // 'Member Type definitions' property of Union Simple Type Definition Schema Component.
        XSObjectList memberTypes = simpleType.getMemberTypes();
    }
   
    //fundamental facet information
   
    //ordered schema component
View Full Code Here

    }

    private void processPSVIFacets(XSSimpleTypeDefinition type) {
        if (type == null)
            return;
        XSObjectList facets = type.getFacets();
        XSObjectList multiValueFacets = type.getMultiValueFacets();
        if ((facets == null || facets.getLength() == 0)
            && (multiValueFacets == null || multiValueFacets.getLength() == 0)) {
            sendElementEvent("psv:facets");
        }
        else {
            sendIndentedElement("psv:facets");
            if (facets != null) {
                for (int i = 0; i < facets.getLength(); i++) {
                    XSFacet facet = (XSFacet)facets.item(i);
                    String name = this.translateFacetKind(facet.getFacetKind());
                    sendIndentedElement("psv:" + name);
                    sendElementEvent("psv:value", facet.getLexicalFacetValue());
                    sendElementEvent(
                        "psv:fixed",
                        String.valueOf(facet.getFixed()));
                    processPSVIAnnotation(facet.getAnnotation());
                    sendUnIndentedElement("psv:" + name);
                }
            }
            if (multiValueFacets != null) {
                for (int i = 0; i < multiValueFacets.getLength(); i++) {
                    XSMultiValueFacet facet =
                        (XSMultiValueFacet)multiValueFacets.item(i);
                    String name = this.translateFacetKind(facet.getFacetKind());
                    sendIndentedElement("psv:" + name);
                    StringList values = facet.getLexicalFacetValues();
                    for (int j = 0; j < values.getLength(); j++) {
                        sendElementEvent("psv:value", values.item(j));
View Full Code Here

      resolver.setBaseURI(baseURI);
      SchemaBinding schema = getXsdBinding().schemaBinding;
      schema.setSchemaResolver(resolver);

      // read annotations. for now just log the ones that are going to be used
      XSObjectList annotations = model.getAnnotations();
      for(int i = 0; i < annotations.getLength(); ++i)
      {
         XSAnnotation annotation = (XSAnnotation)annotations.item(i);
         XsdAnnotation an = XsdAnnotation.unmarshal(annotation.getAnnotationString());
         XsdAppInfo appinfo = an.getAppInfo();
         if(appinfo != null)
         {
            SchemaMetaData schemaBindings = appinfo.getSchemaMetaData();
            if(schemaBindings != null)
            {
               // Get the ignoreUnresolvedFieldOrClass
               schema.setIgnoreUnresolvedFieldOrClass(schemaBindings.isIgnoreUnresolvedFieldOrClass());
               // Get the ignoreUnresolvedFieldOrClass
               schema.setReplacePropertyRefs(schemaBindings.isReplacePropertyRefs());
               // Get the default package
               PackageMetaData packageMetaData = schemaBindings.getPackage();
               if(packageMetaData != null)
               {
                  if(log.isTraceEnabled())
                  {
                     log.trace("schema default package: " + packageMetaData.getName());
                  }
                  schema.setPackageMetaData(packageMetaData);
               }
            }
         }
      }

      /*
      XSTypeDefinition anyType = model.getTypeDefinition(Constants.QNAME_ANYTYPE.getLocalPart(),
         Constants.QNAME_ANYTYPE.getNamespaceURI()
      );
      if(anyType == null)
      {
         throw new JBossXBRuntimeException("Unable to get a refence to " + Constants.QNAME_ANYTYPE);
      }
      */

      SharedElements sharedElements = new SharedElements();
      // this is just caching of the reference to easier compare types at runtime
      //sharedElements.anyType = anyType;

      XSNamedMap groups = model.getComponents(XSConstants.MODEL_GROUP_DEFINITION);
      for(int i = 0; i < groups.getLength(); ++i)
      {
         XSModelGroupDefinition groupDef = (XSModelGroupDefinition)groups.item(i);
         XSModelGroup group = groupDef.getModelGroup();
         XSObjectList particles = group.getParticles();
         for(int j = 0; j < particles.getLength(); ++j)
         {
            XSParticle particle = (XSParticle)particles.item(j);
            XSTerm term = particle.getTerm();
            switch(term.getType())
            {
               case XSConstants.ELEMENT_DECLARATION:
                  XSElementDeclaration element = ((XSElementDeclaration)term);
View Full Code Here

TOP

Related Classes of org.apache.xerces.xs.XSObjectList

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.