Package org.apache.xerces.xs

Examples of org.apache.xerces.xs.XSMultiValueFacet


                    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));
                    }
                    sendElementEvent("psv:fixed", "false");
                    processPSVIAnnotations(facet.getAnnotations());
                    sendUnIndentedElement("psv:" + name);
                }
            }
            sendUnIndentedElement("psv:facets");
        }
View Full Code Here


       
        // 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();
           for (int facValIdex = 0; facValIdex < facetValues.getLength();
                                                 facValIdex++) {
               String facetValue = (String) facetValues.get(facValIdex);
               Element facetDomNode = null;
               if (mvFacet.getFacetKind() == XSSimpleTypeDefinition.
                                             FACET_ENUMERATION) {
                   facetDomNode = document.createElementNS(
                                             XSD_LANGUAGE_URI,
                                             XSD_LANGUAGE_PREFIX +
                                             "enumeration");
               }
               else if (mvFacet.getFacetKind() == XSSimpleTypeDefinition.
                                                  FACET_PATTERN) {
                   facetDomNode = document.createElementNS(
                                             XSD_LANGUAGE_URI,
                                             XSD_LANGUAGE_PREFIX +
                                             "pattern");
View Full Code Here

     */
    private void getAssertsFromBaseTypes(XSSimpleType baseValidator) {
        XSObjectList multiValFacetsOfBaseType = baseValidator.getMultiValueFacets();
       
        for (int i = 0; i < multiValFacetsOfBaseType.getLength(); i++) {
            XSMultiValueFacet mvFacet = (XSMultiValueFacet) multiValFacetsOfBaseType.item(i);
            if (mvFacet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT) {
                // add asserts to the global Vector object
                Vector assertsToAdd = mvFacet.getAsserts();
                for (int j = 0; j < assertsToAdd.size(); j++) {
                   // add assertion to the list, only if it's already not present
                   if (!assertExists((XSAssertImpl)assertsToAdd.get(j))) {
                       baseAsserts.add(assertsToAdd.get(j));
                   }
View Full Code Here

            // check for assertions on types in an non-schema namespace
            if (!SchemaSymbols.URI_SCHEMAFORSCHEMA.equals(memType.getNamespace()) && simpleTypeHasAsserts(memType)) {
                XSObjectList memberTypeFacets = memType.getMultiValueFacets();
                final int memberTypeFacetsLength = memberTypeFacets.getLength();
                for (int memberTypeFacetIdx = 0; memberTypeFacetIdx < memberTypeFacetsLength; memberTypeFacetIdx++) {
                    XSMultiValueFacet facet = (XSMultiValueFacet) memberTypeFacets.item(memberTypeFacetIdx);
                    if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT) {
                        Vector assertFacets = facet.getAsserts();
                        int assertsSucceeded = 0;
                        for (Iterator iter = assertFacets.iterator(); iter.hasNext(); ) {
                            XSAssertImpl assertImpl = (XSAssertImpl) iter.next();
                            try {
                               setTypedValueFor$value(value, memType, null);
View Full Code Here

        boolean hasAssertions = false;
       
        XSObjectList simpleTypeFacets = simpleType.getMultiValueFacets();
        final int simpleTypeFacetsLength = simpleTypeFacets.getLength();
        for (int facetIdx = 0; facetIdx < simpleTypeFacetsLength; facetIdx++) {
            XSMultiValueFacet facet = (XSMultiValueFacet) simpleTypeFacets.item(facetIdx);
            if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT && facet.getAsserts().size() > 0) {
                hasAssertions = true;
                break;
            }
        }
       
View Full Code Here

            else if (baseSchemaType instanceof XSSimpleTypeDefinition) {
                // if schema type is a 'simple type'
                XSObjectList facets = ((XSSimpleTypeDefinition) baseSchemaType).
                                                             getMultiValueFacets();
                for (int facetIdx = 0; facetIdx < facets.getLength(); facetIdx++) {
                    XSMultiValueFacet facet = (XSMultiValueFacet) facets.
                                                                     item(facetIdx);
                    if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT) {
                        Vector assertionFacets = facet.getAsserts();
                        for (int j = 0; j < assertionFacets.size(); j++) {
                           XSAssertImpl assertImpl = (XSAssertImpl)
                                                            assertionFacets.get(j);
                           addAssertion(assertImpl);
                        }
View Full Code Here

       
        // 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();
           for (int facValIdex = 0; facValIdex < facetValues.getLength();
                                                 facValIdex++) {
               String facetValue = (String) facetValues.get(facValIdex);
               Element facetDomNode = null;
               if (mvFacet.getFacetKind() == XSSimpleTypeDefinition.
                                             FACET_ENUMERATION) {
                   facetDomNode = document.createElementNS(
                                             XSD_LANGUAGE_URI,
                                             XSD_LANGUAGE_PREFIX +
                                             "enumeration");
               }
               else if (mvFacet.getFacetKind() == XSSimpleTypeDefinition.
                                                  FACET_PATTERN) {
                   facetDomNode = document.createElementNS(
                                             XSD_LANGUAGE_URI,
                                             XSD_LANGUAGE_PREFIX +
                                             "pattern");
View Full Code Here

                    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));
                    }
                    sendElementEvent("psv:fixed", "false");
                    processPSVIAnnotations(facet.getAnnotations());
                    sendUnIndentedElement("psv:" + name);
                }
            }
            sendUnIndentedElement("psv:facets");
        }
View Full Code Here

          // add assertion facets, from "complexType -> simpleContent -> restriction"
          XSSimpleTypeDefinition simpleTypeDef = complexTypeDef.getSimpleType();
          if (simpleTypeDef != null) {
            XSObjectList complexTypeFacets = simpleTypeDef.getMultiValueFacets();
            for (int i = 0; i < complexTypeFacets.getLength(); i++) {
              XSMultiValueFacet facet = (XSMultiValueFacet) complexTypeFacets.item(i);
              if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT) {
                 Vector simpleContentAsserts = facet.getAsserts();
                 for (int simpleAssertIdx = 0; simpleAssertIdx <
                              simpleContentAsserts.size(); simpleAssertIdx++) {
                    XSAssert simpleContentAssert = (XSAssert)
                                         simpleContentAsserts.get(simpleAssertIdx);
                    assertions.addXSObject(simpleContentAssert);
                 }
              }
            }
          }

          // there could be assertions, to be evaluated on attributes. add these
          // assertions to the list of assertions to be processed.
          for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) {
              Augmentations attrAugs = attributes.getAugmentations(attrIndx);
              AttributePSVImpl attrPSVI = (AttributePSVImpl)attrAugs.getItem
                                                 (Constants.ATTRIBUTE_PSVI);
              XSSimpleTypeDefinition attrType = (XSSimpleTypeDefinition)attrPSVI.
                                                        getTypeDefinition();
              if (attrType != null) {
                 XSObjectList facets = attrType.getMultiValueFacets();             
                 for (int i = 0; i < facets.getLength(); i++) {
                    XSMultiValueFacet facet = (XSMultiValueFacet) facets.item(i);
                    if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT) {
                       Vector attrAsserts = facet.getAsserts();
                       for (int j = 0; j < attrAsserts.size(); j++) {
                         XSAssertImpl attrAssert = (XSAssertImpl) attrAsserts.elementAt(j);
                         attrAssert.setAttrName(attributes.getLocalName(attrIndx));
                         attrAssert.setAttrValue(attributes.getValue(attrIndx));
                         assertions.addXSObject(attrAssert);   
                       }                       
                       break;
                    }
                 }
              }
          }
             
          if (assertions.size() > 0) {
              assertObject = assertions;            
              // instantiate the assertions processor
              if (fAssertionProcessor == null) {
                // construct parameter values for the assertion processor
                Map assertProcessorParams = new HashMap();
                assertProcessorParams.put("XPATH2_NS_CONTEXT",
                                     ((XSAssertImpl)assertions.get(0)).
                                     getXPath2NamespaceContext());
                // initialize the assertions processor
                initializeAssertProcessor(assertProcessorParams);
              }
          }
        }
        else if (typeDef.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
            // if element's governing type is a "simple type"
            XSSimpleTypeDefinition simpleTypeDef = (XSSimpleTypeDefinition) typeDef;
            XSObjectList facets = simpleTypeDef.getMultiValueFacets();
            for (int i = 0; i < facets.getLength(); i++) {
              XSMultiValueFacet facet = (XSMultiValueFacet) facets.item(i);
              if (facet.getFacetKind() == XSSimpleTypeDefinition.FACET_ASSERT) {
                assertObject = facet.getAsserts();
                // instantiate the assertions processor
                if (fAssertionProcessor == null) {
                   // construct parameter values for the assertion processor
                   Map assertProcessorParams = new HashMap();
                   assertProcessorParams.put("XPATH2_NS_CONTEXT",
                                     ((XSAssertImpl)facet.getAsserts().get(0)).
                                     getXPath2NamespaceContext());
                   // initialize the assertions processor
                   initializeAssertProcessor(assertProcessorParams);
                }
                break;
View Full Code Here

                    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));
                    }
                    sendElementEvent("psv:fixed", "false");
                    processPSVIAnnotations(facet.getAnnotations());
                    sendUnIndentedElement("psv:" + name);
                }
            }
            sendUnIndentedElement("psv:facets");
        }
View Full Code Here

TOP

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

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.