Examples of XSMultiValueFacet


Examples of org.apache.xerces.xs.XSMultiValueFacet

          // 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

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

Examples of org.apache.xerces.xs.XSMultiValueFacet

     */
    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

Examples of org.apache.xerces.xs.XSMultiValueFacet

               }
            }
            else if (baseValidator instanceof XSSimpleTypeDefinition) {
                XSObjectList facets = ((XSSimpleTypeDefinition)baseValidator).getMultiValueFacets();
                for (int i = 0; i < facets.getLength(); i++) {
                    XSMultiValueFacet facet = (XSMultiValueFacet) facets.item(i);
                    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);
                       }
                       break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.