//reportSchemaError("s4s-elt-must-match.1", new Object[] { "type alternative", "(annotation?, (simpleType|complexType)?)", childNode.getLocalName() }, altElement);
reportSchemaError("s4s-elt-must-match.1", new Object[]{"type alternative", "(annotation?, (simpleType | complexType)?)", DOMUtil.getLocalName(childNode)}, childNode);
}
// 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);
}
if (xpathNS != null) {
//set the xpathDefaultNamespace attribute value
typeAlternative.setXPathDefauleNamespace(xpathNS);
}
grammar.addTypeAlternative(element, typeAlternative);
fAttrChecker.returnAttrArray(attrValues, schemaDoc);
}