Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSSimpleTypeDefinition


    private XSAssertImpl getFirstAssertFromUnionMemberTypes(XSObjectList memberTypes) {
       
        XSAssertImpl assertImpl = null;
       
        for (int memberTypeIdx = 0; memberTypeIdx < memberTypes.getLength(); memberTypeIdx++) {
            XSSimpleTypeDefinition memType = (XSSimpleTypeDefinition) memberTypes.item(memberTypeIdx);
            if (!SchemaSymbols.URI_SCHEMAFORSCHEMA.equals(memType.getNamespace())) {
                XSObjectList memberTypeFacets = memType.getMultiValueFacets();
                for (int memberTypeFacetIdx = 0; memberTypeFacetIdx < memberTypeFacets.getLength();
                                                                                memberTypeFacetIdx++) {
                    XSMultiValueFacet facet = (XSMultiValueFacet) memberTypeFacets.item(memberTypeFacetIdx);
                    if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT) {
                        Vector assertFacets = facet.getAsserts();
View Full Code Here


   {
      try
      {
         if (particleTerm.getTypeDefinition() instanceof XSSimpleTypeDefinition)
         {
            XSSimpleTypeDefinition typeDef = (XSSimpleTypeDefinition)particleTerm.getTypeDefinition();
           
            if (typeDef.getBuiltInKind() == XSConstants.STRING_DT && XSDUtil.getEnumeration(typeDef).length == 0)
            {
               int nMinOccurs = 0;
              
               if (particle.getMinOccurs() > 0)
               {
                  nMinOccurs = particle.getMinOccurs();
               }
               else if (typeDef.isDefinedFacet(XSSimpleTypeDefinition.FACET_MINLENGTH))
               {
                  String sMinLength = typeDef.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MINLENGTH);
                  int nMinLength = Primitive.toInteger(sMinLength).intValue();
                 
                  if (nMinLength > 0)
                  {
                     nMinOccurs = 1;
View Full Code Here

                  primitivePart.setType(Primitive.BOOLEAN);

                  if (typeDef instanceof XSSimpleTypeDefinition && typeDef.getBaseType() != null
                     && typeDef.getBaseType().derivedFrom(XML_SCHEMA, BOOLEAN_TYPE, (short)XSConstants.DERIVATION_RESTRICTION))
                  {
                     XSSimpleTypeDefinition st = (XSSimpleTypeDefinition)typeDef;
                     StringList s = st.getLexicalPattern();

                     if (s.getLength() == 1)
                     {
                        String sPattern = s.item(0);
View Full Code Here

   /**
    * @return true if attrDecl is type boolean.
    */
   static public boolean isBooleanAttribute(XSAttributeDeclaration attrDecl)
   {
      XSSimpleTypeDefinition def = attrDecl.getTypeDefinition();
      def = def.getPrimitiveType();
     
      if (def == null)
      {
         return false;     
      }
     
      return (def.getName().equals("boolean"));
   }
View Full Code Here

    * Validates a string against an attribute type with a pattern.
    * @return Error message or null value if successful.
    */  
   static public String validate(String value, XSAttributeDeclaration attrDecl)
   {
      XSSimpleTypeDefinition def = attrDecl.getTypeDefinition();
     
      if (!(def instanceof XSSimpleType))
      {
         return null;     
      }
View Full Code Here

        processPSVIAttributeWildcard(type.getAttributeWildcard());
        sendIndentedElement("psv:contentType");
        sendElementEvent(
            "psv:variety",
            this.translateContentType(type.getContentType()));
        XSSimpleTypeDefinition simpleType = type.getSimpleType();
        if(simpleType == null || (!simpleType.getAnonymous() || fDefined.contains(this.getID(simpleType)))) {
            processPSVIElementRef("psv:simpleTypeDefinition", simpleType);
        }
        else {
            processPSVISimpleTypeDefinition(simpleType);
        }
View Full Code Here

            addRestrictionToSimpleContent(document, simpleTypeDecl,
                            simpleTypeDomNode, restrictionDomNode, baseType);
        }
        else if (simpleTypeDecl.getVariety() ==
                       XSSimpleTypeDefinition.VARIETY_LIST) {
           XSSimpleTypeDefinition listType = simpleTypeDecl.getItemType();
           addListDeclToSimpleType(document, simpleTypeDomNode, listType);
        }
        else if (simpleTypeDecl.getVariety() ==
                       XSSimpleTypeDefinition.VARIETY_UNION) {
           XSObjectList unionMemberTypes = simpleTypeDecl.getMemberTypes();          
View Full Code Here

            restrictionDomNode.setAttributeNS(null, "base"
                                       baseType.getName());  
        }               
       
        // simple type definition to be used, to get the facets
        XSSimpleTypeDefinition simpleTypeDefn = null;
       
        if (typeDefn instanceof XSComplexTypeDefinition) {
            XSComplexTypeDefinition complexTypeDefn = (XSComplexTypeDefinition) typeDefn;
            simpleTypeDefn = complexTypeDefn.getSimpleType();
           
        }
        else {
            simpleTypeDefn = (XSSimpleTypeDefinition) typeDefn;    
        }
       
        // handling single-valued Facets
        XSObjectList facets = simpleTypeDefn.getFacets();
        for (int facetIdx = 0; facetIdx < facets.getLength(); facetIdx++) {
            XSFacet facet = (XSFacet) facets.item(facetIdx);                       
            String facetName = getFacetName(facet.getFacetKind());
            String facetValue = facet.getLexicalFacetValue();
            Element facetDomNode = document.createElementNS(
                                            XSD_LANGUAGE_URI,
                                            XSD_LANGUAGE_PREFIX +
                                            facetName);
            facetDomNode.setAttributeNS(null, "value", facetValue);
            restrictionDomNode.appendChild(facetDomNode);
        }
       
        // handling multi-valued Facets ("enumeration" or "pattern")
        XSObjectList mvFacets = simpleTypeDefn.getMultiValueFacets();
        for (int mvFacetIdx = 0; mvFacetIdx < mvFacets.getLength();
                                              mvFacetIdx++) {
           XSMultiValueFacet mvFacet = (XSMultiValueFacet)
                                              mvFacets.item(mvFacetIdx);
           StringList facetValues = mvFacet.getLexicalFacetValues();
View Full Code Here

            // set PSVI information on the element
            ElementPSVI elemPSVI = (ElementPSVI) augs.getItem(Constants.ELEMENT_PSVI);
            ((PSVIElementNSImpl) fCurrentAssertDomNode).setPSVI(elemPSVI);
      
            // itemType for xs:list
            XSSimpleTypeDefinition itemType = null;
           
            // memberTypes for xs:union
            XSObjectList memberTypes = null;
           
            if (elemPSVI.getTypeDefinition().getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
                XSSimpleTypeDefinition simpleTypeDefn = (XSSimpleTypeDefinition) elemPSVI.getTypeDefinition();
                itemType = simpleTypeDefn.getItemType();
                if (itemType == null) {
                    memberTypes = simpleTypeDefn.getMemberTypes();   
                }
            }
           
            if (!fAssertRootStack.empty() && (fCurrentAssertDomNode == fAssertRootStack.peek())) {              
                 // get XSModel instance               
View Full Code Here

                xpathContextExists = true;  
            }
            // check if this is an assertion, from an attribute
            if (assertImpl.getAttrName() != null) {
                value = assertImpl.getAttrValue();
                XSSimpleTypeDefinition attrType = (XSSimpleTypeDefinition) assertImpl.getTypeDefinition();
                attrMemberTypes = attrType.getMemberTypes();
                if (assertImpl.getVariety() == XSSimpleTypeDefinition.VARIETY_LIST) {
                    // this assertion belongs to a type, that is an item type of a "simpleType -> list".
                    // tokenize the list value by the longest sequence of white-spaces.
                    StringTokenizer values = new StringTokenizer(value, " \n\t\r");
                   
View Full Code Here

TOP

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

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.