Package org.apache.xerces.impl.xs.alternative

Examples of org.apache.xerces.impl.xs.alternative.Test


        // create type alternative
        XSTypeAlternativeImpl typeAlternative = new XSTypeAlternativeImpl(element.fName, alternativeType, annotations);

        // now look for other optional attributes like test and xpathDefaultNamespace
        if (test != null) {
            Test testExpr = null;
            //set the test attribute value
            try {
               testExpr = new Test(new XPath20(test, fSymbolTable, schemaDoc.fNamespaceSupport),
                                       typeAlternative,
                                       schemaDoc.fNamespaceSupport);
            }
            catch (XPathException e) {
               // fall back to full XPath 2.0 support, with PsychoPath engine
               try {
                  XPathParser xpp = new JFlexCupParser();
                  XPath xp = xpp.parse("boolean(" + test + ")");
                  testExpr = new Test(xp, typeAlternative, schemaDoc.fNamespaceSupport);
               } catch(XPathParserException ex) {
                  reportSchemaError("c-cta-xpath", new Object[] { test }, altElement);
                  //if the XPath is invalid, create a Test without an expression
                  testExpr = new Test((XPath20) null, typeAlternative,
                                       schemaDoc.fNamespaceSupport);
               }               
            }           
            typeAlternative.setTest(testExpr);
        }
View Full Code Here


        if (alternatives != null) {             
            // Construct a list of attributes needed for CTA processing. This includes inherited attributes as well.
            XMLAttributes ctaAttributes = getAttributesForCTA(attributes);
           
            for (int i = 0; i < alternatives.length; i++) {
                Test test = alternatives[i].getTest();
                if (test != null && test.evaluateTest(element, ctaAttributes)) {
                    currentType = alternatives[i].getTypeDefinition();
                    typeSelected = true;
                    break;
                }
            }
View Full Code Here

                // This method call, adds inherited attributes as well, to the list
                // of attributes.
                XMLAttributes ctaAttributes = getAttributesForCTA(attributes);
               
                for (int i = 0; i < alternatives.length; i++) {
                    Test test = alternatives[i].getTest();
                    if (test != null && test.evaluateTest(element, ctaAttributes)) {
                        fCurrentType = alternatives[i].getTypeDefinition();
                        typeSelected = true;
                        break;
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.xerces.impl.xs.alternative.Test

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.