Author: mukulg
Date: Sat May 29 09:07:37 2021
New Revision: 1890307
URL: http://svn.apache.org/viewvc?rev=1890307&view=rev
Log:
minor code refactoring and java program 'name' changes, within xercesj XML
Schema 1.1 implementation
Added:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractXPath2EngineImpl.java
- copied, changed from r1873816,
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathXPath2Impl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertXPath2EngineImpl.java
- copied, changed from r1873816,
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java
Removed:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathXPath2Impl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/alternative/Test.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertImpl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XS11TypeHelper.java
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java?rev=1890307&r1=1890306&r2=1890307&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/Constants.java
Sat May 29 09:07:37 2021
@@ -500,7 +500,7 @@ public final class Constants {
public final static short TYPE_AND_FACET_AVAILABILITY = 2;
public final static short TYPE_AND_FACET_UNAVAILABILITY = 3;
- // Constants to support PsychoPath XPath engine uses
+ // Constants to support Eclipse XPath 2.0 engine uses
public final static String XPATH2_NAMESPACE_CONTEXT = "XPATH2_NS_CONTEXT";
public final static String IS_CTA_EVALUATOR = "CTA-EVALUATOR";
Copied:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractXPath2EngineImpl.java
(from r1873816,
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathXPath2Impl.java)
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractXPath2EngineImpl.java?p2=xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractXPath2EngineImpl.java&p1=xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathXPath2Impl.java&r1=1873816&r2=1890307&rev=1890307&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathXPath2Impl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractXPath2EngineImpl.java
Sat May 29 09:07:37 2021
@@ -52,31 +52,31 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
- * A class providing common services for XPath expression evaluation, with
- * "PsychoPath XPath 2.0" engine
(https://wiki.eclipse.org/PsychoPathXPathProcessor).
+ * A class providing common services for XPath expression evaluation, using
+ * "Eclipse XPath 2.0" engine (https://www.eclipse.org/webtools).
*
* @xerces.internal
*
* @author Mukul Gandhi, IBM
* @version $Id$
*/
-public class AbstractPsychoPathXPath2Impl {
+public class AbstractXPath2EngineImpl {
private DynamicContext fXpath2DynamicContext = null;
private Document fDomDoc = null;
/*
- * Initialize the PsychoPath engine XPath 2.0 dynamic context. This also
initializes the XPath engine's static
- * context, since dynamic context is inherited from the static context.
+ * Initialize the XPath 2.0 engine's dynamic context. This also
initializes the XPath engine's static
+ * context as well, since dynamic context is inherited from the static
context.
*/
- public DynamicContext initXPath2DynamicContext(XSModel schema, Document
document, Map psychoPathParams) {
+ public DynamicContext initXPath2DynamicContext(XSModel schema, Document
document, Map xpathEngineParams) {
fXpath2DynamicContext = new DefaultDynamicContext(schema, document);
- // populate the 'PsychoPath XPath 2' static context, with namespace
bindings derived from the XML Schema document
- NamespaceSupport xpath2NamespaceContext = (NamespaceSupport)
psychoPathParams.get(Constants.XPATH2_NAMESPACE_CONTEXT);
- Boolean isCtaEvaluator =
(Boolean)psychoPathParams.get(Constants.IS_CTA_EVALUATOR);
+ // populate the "XPath 2 engine" static context, with namespace
bindings derived from the XML Schema document
+ NamespaceSupport xpath2NamespaceContext = (NamespaceSupport)
xpathEngineParams.get(Constants.XPATH2_NAMESPACE_CONTEXT);
+ Boolean isCtaEvaluator =
(Boolean)xpathEngineParams.get(Constants.IS_CTA_EVALUATOR);
if (isCtaEvaluator != null && isCtaEvaluator.booleanValue()) {
// check if the call to this method came from CTA evaluator. needs
special treatment for handling namespace context.
String[] namespaceBindingInfo =
xpath2NamespaceContext.getNamespaceBindingInfo();
@@ -112,7 +112,7 @@ public class AbstractPsychoPathXPath2Imp
/*
- * Evaluate XPath expression with PsychoPath XPath2 engine.
+ * Evaluate XPath expression using the XPath2 engine.
*/
protected boolean evaluateXPathExpr(XPath xpathObject, Element
contextNode) throws Exception {
@@ -203,4 +203,4 @@ public class AbstractPsychoPathXPath2Imp
return uri;
} // getURIXS11CTA
-} // class AbstractPsychoPathXPath2Impl
+} // class AbstractXPath2EngineImpl
Copied:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertXPath2EngineImpl.java
(from r1873816,
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java)
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertXPath2EngineImpl.java?p2=xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertXPath2EngineImpl.java&p1=xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java&r1=1873816&r2=1890307&rev=1890307&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathXPath2Impl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertXPath2EngineImpl.java
Sat May 29 09:07:37 2021
@@ -60,12 +60,11 @@ import org.w3c.dom.Element;
/**
* A class implementing an XPath interface for XML Schema 1.1 "assertions"
evaluation. This class interfaces with
- * the "PsychoPath XPath 2.0" engine
(https://wiki.eclipse.org/PsychoPathXPathProcessor) for XPath expression
- * evaluations for XSD assertions.
+ * the "XPath 2.0" engine (https://www.eclipse.org/webtools) for XPath
expression evaluations for XSD assertions.
*
- * An instance of this class constructs Xerces PSVI enabled DOM trees (which
are in-memory XDM
- * representation for PsychoPath XPath 2.0 engine) from XNI event calls. XSD
assertions
- * are evaluated on these PSVI XDM instances in a bottom up fashion.
+ * An instance of this class constructs Xerces PSVI enabled DOM trees (which
are in-memory XDM representation for
+ * XPath 2.0 engine) from XNI event calls. XSD assertions are evaluated on
these PSVI XDM instances in a bottom
+ * up fashion.
*
* @xerces.internal
*
@@ -74,18 +73,18 @@ import org.w3c.dom.Element;
*
* @version $Id$
*/
-public class XMLAssertPsychopathXPath2Impl extends XMLAssertAdapter {
+public class XMLAssertXPath2EngineImpl extends XMLAssertAdapter {
// class fields declarations
- // XSModel instance representing the schema information needed by
PsychoPath XPath 2.0 engine
+ // XSModel instance representing the schema information needed by XPath
2.0 engine
private XSModel fSchemaXSmodel = null;
// XPath 2.0 dynamic context reference
private DynamicContext fXpath2DynamicContext;
- // reference to the PsychoPath XPath evaluator
- private AbstractPsychoPathXPath2Impl fAbstrPsychopathImpl = null;
+ // reference to the Eclipse XPath evaluator
+ private AbstractXPath2EngineImpl fAbstrXpathEngineImpl = null;
// the DOM root of assertions tree
private Document fAssertDocument = null;
@@ -102,7 +101,7 @@ public class XMLAssertPsychopathXPath2Im
// XMLSchemaValidator reference. set from the XMLSchemaValidator object
itself.
private XMLSchemaValidator fXmlSchemaValidator = null;
- // parameters to pass to PsychoPath XPath engine (for e.g, the XML
namespace bindings)
+ // parameters to pass to XPath engine (for e.g, the XML namespace bindings)
private Map fAssertParams = null;
// failed assertions for an "element information item"
@@ -115,7 +114,7 @@ public class XMLAssertPsychopathXPath2Im
/*
* Class constructor.
*/
- public XMLAssertPsychopathXPath2Impl(Map assertParams) {
+ public XMLAssertXPath2EngineImpl(Map assertParams) {
// initializing the class variables
this.fAssertDocument = new PSVIDocumentImpl();
this.fAssertRootStack = new Stack();
@@ -125,12 +124,12 @@ public class XMLAssertPsychopathXPath2Im
/*
- * Initialize the PsychoPath XPath processor.
+ * Initialize the Eclipse XPath processor.
*/
private void initXPathProcessor() throws Exception {
fXmlSchemaValidator = (XMLSchemaValidator)
getProperty("http://apache.org/xml/properties/assert/validator");
- fAbstrPsychopathImpl = new AbstractPsychoPathXPath2Impl();
- fXpath2DynamicContext =
fAbstrPsychopathImpl.initXPath2DynamicContext(fSchemaXSmodel, fAssertDocument,
fAssertParams);
+ fAbstrXpathEngineImpl = new AbstractXPath2EngineImpl();
+ fXpath2DynamicContext =
fAbstrXpathEngineImpl.initXPath2DynamicContext(fSchemaXSmodel, fAssertDocument,
fAssertParams);
} // initXPathProcessor
@@ -577,11 +576,11 @@ public class XMLAssertPsychopathXPath2Im
boolean result;
if (value == null || xPathContextExists == true) {
- result = fAbstrPsychopathImpl.evaluateXPathExpr(xpathObject,
fCurrentAssertDomNode);
+ result = fAbstrXpathEngineImpl.evaluateXPathExpr(xpathObject,
fCurrentAssertDomNode);
}
else {
// XPath context is "undefined"
- result = fAbstrPsychopathImpl.evaluateXPathExpr(xpathObject,
null);
+ result = fAbstrXpathEngineImpl.evaluateXPathExpr(xpathObject,
null);
}
if (!result) {
@@ -833,4 +832,4 @@ public class XMLAssertPsychopathXPath2Im
return ((XSSimpleType) simpleTypeDefn.getBaseType()).getVariety() ==
XSSimpleType.VARIETY_UNION;
}
-} // class XMLAssertPsychopathXPath2Impl
+} // class XMLAssertXPath2EngineImpl
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java?rev=1890307&r1=1890306&r2=1890307&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDAssertionValidator.java
Sat May 29 09:07:37 2021
@@ -65,7 +65,7 @@ public class XSDAssertionValidator {
// assertion processor object reference
XMLAssertHandler fAssertionProcessor = null;
- // variable to track if attributes on current element, have assertions.
+ // variable to track if attributes on current element, have assertions
boolean fAttributesHaveAsserts = false;
@@ -348,8 +348,9 @@ public class XSDAssertionValidator {
}
if (assertProcessorProp == null || assertProcessorProp.length() == 0) {
- // if assertion processor is not specified via a system property,
initialize it to the "PsychoPath XPath 2.0" processor.
- fAssertionProcessor = new
XMLAssertPsychopathXPath2Impl(assertParams);
+ // if assertion processor is not specified via a system property,
+ // initialize it to an "Eclipse XPath 2.0" processor.
+ fAssertionProcessor = new XMLAssertXPath2EngineImpl(assertParams);
}
else {
try {
@@ -384,8 +385,10 @@ public class XSDAssertionValidator {
AttributePSVImpl attrPsvi =
(AttributePSVImpl)attrAugs.getItem(Constants.ATTRIBUTE_PSVI);
XSSimpleTypeDefinition attrSimpleType = (XSSimpleTypeDefinition)
attrPsvi.getTypeDefinition();
List isAssertProcessingNeededForSTUnionAttrs =
fXmlSchemaValidator.getIsAssertProcessingNeededForSTUnionAttrs();
- if (attrSimpleType != null && attrSimpleType.getVariety() ==
XSSimpleTypeDefinition.VARIETY_UNION && ((XSSimpleType)
attrSimpleType.getBaseType()).getVariety() !=
XSSimpleTypeDefinition.VARIETY_UNION) {
- if
(XS11TypeHelper.isAtomicStrValueValidForSTUnion(attrSimpleType.getMemberTypes(),
attrsImpl.getValue(attrIdx), attrPsvi.fValue, Constants.SCHEMA_VERSION_1_1)) {
+ if (attrSimpleType != null && attrSimpleType.getVariety() ==
XSSimpleTypeDefinition.VARIETY_UNION &&
+ ((XSSimpleType) attrSimpleType.getBaseType()).getVariety() !=
XSSimpleTypeDefinition.VARIETY_UNION) {
+ if
(XS11TypeHelper.isAtomicStrValueValidForSTUnion(attrSimpleType.getMemberTypes(),
attrsImpl.getValue(attrIdx),
+
attrPsvi.fValue, Constants.SCHEMA_VERSION_1_1)) {
isAssertProcessingNeededForSTUnionAttrs.add(Boolean.valueOf(false));
}
else {
@@ -403,8 +406,10 @@ public class XSDAssertionValidator {
* Extra checks for assertion evaluations for simpleType definitions with
variety union, for an element.
*/
void extraCheckForSTUnionAssertsElem(XSSimpleType simpleTypeDv, String
content, ValidatedInfo validatedInfo) {
- if (simpleTypeDv.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION
&& ((XSSimpleType) simpleTypeDv.getBaseType()).getVariety() !=
XSSimpleTypeDefinition.VARIETY_UNION) {
- if
(XS11TypeHelper.isAtomicStrValueValidForSTUnion(simpleTypeDv.getMemberTypes(),
content, validatedInfo, Constants.SCHEMA_VERSION_1_1)) {
+ if (simpleTypeDv.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION
&&
+ ((XSSimpleType) simpleTypeDv.getBaseType()).getVariety() !=
XSSimpleTypeDefinition.VARIETY_UNION) {
+ if
(XS11TypeHelper.isAtomicStrValueValidForSTUnion(simpleTypeDv.getMemberTypes(),
content,
+ validatedInfo,
Constants.SCHEMA_VERSION_1_1)) {
fXmlSchemaValidator.setIsAssertProcessingNeededForSTUnionElem(false);
}
}
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/alternative/Test.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/alternative/Test.java?rev=1890307&r1=1890306&r2=1890307&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/alternative/Test.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/alternative/Test.java
Sat May 29 09:07:37 2021
@@ -29,7 +29,7 @@ import org.apache.xerces.dom.PSVIDocumen
import org.apache.xerces.dom.PSVIElementNSImpl;
import org.apache.xerces.impl.Constants;
import org.apache.xerces.impl.xpath.XPath20;
-import org.apache.xerces.impl.xs.AbstractPsychoPathXPath2Impl;
+import org.apache.xerces.impl.xs.AbstractXPath2EngineImpl;
import org.apache.xerces.impl.xs.SchemaSymbols;
import org.apache.xerces.util.NamespaceSupport;
import org.apache.xerces.xni.NamespaceContext;
@@ -49,7 +49,7 @@ import org.w3c.dom.Element;
* @author Mukul Gandhi IBM
* @version $Id$
*/
-public class Test extends AbstractPsychoPathXPath2Impl {
+public class Test extends AbstractXPath2EngineImpl {
/** The type alternative to which the test belongs */
protected final XSTypeAlternativeImpl fTypeAlternative;
@@ -57,11 +57,11 @@ public class Test extends AbstractPsycho
/** String representation of the XPath */
protected final String fExpression;
- /** XPath 2.0 expression. Xerces-J native XPath 2.0 subset. */
+ /** Xerces-J native XPath 2.0 subset expression object. */
protected final XPath20 fXPath;
- /** XPath 2.0 expression. PsychoPath XPath 2.0 expression object. */
- protected final XPath fXPathPsychoPath;
+ /** XPath 2.0 expression. Eclipse XPath 2.0 expression object. */
+ protected final XPath fEclipseXPathImpl;
/** XPath 2.0 namespace context. Derived from XSDocumentInfo in XSD
traversers. */
protected final NamespaceSupport fXPath2NamespaceContext;
@@ -70,18 +70,18 @@ public class Test extends AbstractPsycho
public Test(XPath20 xpath, XSTypeAlternativeImpl typeAlternative,
NamespaceSupport namespaceContext) {
fXPath = xpath;
fExpression = xpath == null ? "" : xpath.getXPathStrValue();
- fXPathPsychoPath = null;
+ fEclipseXPathImpl = null;
fTypeAlternative = typeAlternative;
fXPath2NamespaceContext = namespaceContext;
}
/*
- * Constructs a "test" for type alternatives. An overloaded constructor,
for PsychoPath XPath processor.
+ * Constructs a "test" for type alternatives. An overloaded constructor,
for Eclipse XPath processor.
*/
public Test(XPath xpath, String expression, XSTypeAlternativeImpl
typeAlternative, NamespaceSupport namespaceContext) {
fXPath = null;
fExpression = expression == null ? "" : expression;
- fXPathPsychoPath = xpath;
+ fEclipseXPathImpl = xpath;
fTypeAlternative = typeAlternative;
fXPath2NamespaceContext = namespaceContext;
}
@@ -95,16 +95,16 @@ public class Test extends AbstractPsycho
}
/*
- * Returns the test XPath expression object. Return the native Xerces
XPath object or the PsychoPath XPath object,
- * whichever is available.
+ * Returns the test XPath expression object. Return the native Xerces
XPath object or the
+ * Eclipse XPath object, whichever is available.
*/
public Object getXPath() {
Object xpath = null;
if (fXPath != null) {
xpath = fXPath;
- } else if (fXPathPsychoPath != null) {
- xpath = fXPathPsychoPath;
+ } else if (fEclipseXPathImpl != null) {
+ xpath = fEclipseXPathImpl;
}
return xpath;
@@ -114,8 +114,8 @@ public class Test extends AbstractPsycho
public boolean evaluateTest(QName element, XMLAttributes attributes,
NamespaceContext instanceNamespaceContext, String expandedSystemId) {
if (fXPath != null) {
return fXPath.evaluateTest(element, attributes);
- } else if (fXPathPsychoPath != null) {
- return evaluateTestWithPsychoPathXPathEngine(element, attributes,
instanceNamespaceContext, expandedSystemId);
+ } else if (fEclipseXPathImpl != null) {
+ return evaluateTestWithEclipseXPathEngine(element, attributes,
instanceNamespaceContext, expandedSystemId);
}
else {
return false;
@@ -127,15 +127,18 @@ public class Test extends AbstractPsycho
}
/*
- * Evaluate the XPath "test" expression on an XDM instance, for CTA
evaluation. Uses PsychoPath XPath 2.0 engine for the evaluation.
+ * Evaluate the XPath "test" expression on an XDM instance, for CTA
evaluation.
+ * Uses Eclipse XPath 2.0 engine for the evaluation.
*/
- private boolean evaluateTestWithPsychoPathXPathEngine(QName element,
XMLAttributes attributes, NamespaceContext instanceNamespaceContext, String
expandedSystemId) {
+ private boolean evaluateTestWithEclipseXPathEngine(QName element,
XMLAttributes attributes,
+ NamespaceContext
instanceNamespaceContext,
+ String
expandedSystemId) {
boolean evaluationResult = false;
try {
// an untyped PSVI DOM tree (consisting only of the top most
element node and it's attributes) is constructed,
- // to provide to PsychoPath XPath engine for evaluation.
+ // to provide to XPath engine for evaluation.
Document document = new PSVIDocumentImpl();
document.setDocumentURI(expandedSystemId); // an approximation
(the URI of the parent document) of the document URI for this <alternative>,
document tree
Element elem = new PSVIElementNSImpl((CoreDocumentImpl) document,
element.uri, element.rawname);
@@ -158,16 +161,16 @@ public class Test extends AbstractPsycho
document.appendChild(elem);
- // construct parameter values for psychopath xpath processor
- Map psychoPathParams = new HashMap();
- psychoPathParams.put(Constants.XPATH2_NAMESPACE_CONTEXT,
fXPath2NamespaceContext);
- psychoPathParams.put(Constants.IS_CTA_EVALUATOR, Boolean.TRUE);
- DynamicContext xpath2DynamicContext =
initXPath2DynamicContext(null, document, psychoPathParams);
+ // construct parameter values for eclipse xpath processor
+ Map eclipseXpathParams = new HashMap();
+ eclipseXpathParams.put(Constants.XPATH2_NAMESPACE_CONTEXT,
fXPath2NamespaceContext);
+ eclipseXpathParams.put(Constants.IS_CTA_EVALUATOR, Boolean.TRUE);
+ DynamicContext xpath2DynamicContext =
initXPath2DynamicContext(null, document, eclipseXpathParams);
xpath2DynamicContext.set_base_uri(fTypeAlternative.getBaseURI());
// set base-uri property in XPath2 static context, to the URI of XSD document
if (fTypeAlternative.fXPathDefaultNamespace != null) {
addNamespaceBindingToXPath2DynamicContext(null,
fTypeAlternative.fXPathDefaultNamespace);
}
- evaluationResult = evaluateXPathExpr(fXPathPsychoPath, elem);
+ evaluationResult = evaluateXPathExpr(fEclipseXPathImpl, elem);
}
catch(Exception ex) {
evaluationResult = false;
@@ -175,6 +178,6 @@ public class Test extends AbstractPsycho
return evaluationResult;
- } // evaluateTestWithPsychoPathXPathEngine
+ } // evaluateTestWithEclipseXPathEngine
}
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertImpl.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertImpl.java?rev=1890307&r1=1890306&r2=1890307&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertImpl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertImpl.java
Sat May 29 09:07:37 2021
@@ -17,7 +17,7 @@
package org.apache.xerces.impl.xs.assertion;
-import org.apache.xerces.impl.xs.AbstractPsychoPathXPath2Impl;
+import org.apache.xerces.impl.xs.AbstractXPath2EngineImpl;
import org.apache.xerces.impl.xs.traversers.XSDHandler;
import org.apache.xerces.impl.xs.util.XS11TypeHelper;
import org.apache.xerces.util.NamespaceSupport;
@@ -36,7 +36,7 @@ import org.w3c.dom.Element;
* @author Mukul Gandhi, IBM
* @version $Id$
*/
-public class XSAssertImpl extends AbstractPsychoPathXPath2Impl implements
XSAssert {
+public class XSAssertImpl extends AbstractXPath2EngineImpl implements XSAssert
{
// The kind of assertion this is
private short fAssertKind = XSConstants.ASSERTION;
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java?rev=1890307&r1=1890306&r2=1890307&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/XSAssertionXPath2ValueImpl.java
Sat May 29 09:07:37 2021
@@ -45,7 +45,7 @@ import org.w3c.dom.NodeList;
/**
* This class defines a set of methods to work with XPath 2.0 dynamic context
- * variable "$value", that is needed for assertions evaluation.
+ * variable "$value", that is needed for XSD assertions evaluation.
*
* @xerces.internal
*
@@ -96,7 +96,9 @@ public class XSAssertionXPath2ValueImpl
if (textChildCount == effectiveChildNodeCount) {
// the DOM tree we are inspecting has simple content.
therefore we can find the desired string value.
- if
((pElemPSVI.getTypeDefinition()).derivedFrom(SchemaSymbols.URI_SCHEMAFORSCHEMA,
SchemaSymbols.ATTVAL_STRING, XSConstants.DERIVATION_RESTRICTION)) {
+ if
((pElemPSVI.getTypeDefinition()).derivedFrom(SchemaSymbols.URI_SCHEMAFORSCHEMA,
+
SchemaSymbols.ATTVAL_STRING,
+
XSConstants.DERIVATION_RESTRICTION)) {
// if element's schema type is derived by restriction from
xs:string, white-space normalization is not needed for the
// string value for context variable $value.
strValueOf$value = textValueContents.toString();
@@ -114,17 +116,20 @@ public class XSAssertionXPath2ValueImpl
/*
- * Given a string value, this method sets an XPath 2.0 typed value for
variable "$value" in XPath dynamic context. This method delegates
- * to other methods of interface XSAssertionXPath2Value to carry some of
it's tasks.
+ * Given a string value, this method sets an XPath 2.0 typed value for
variable "$value" in XPath dynamic context.
+ * This method delegates to other methods of interface
XSAssertionXPath2Value to carry some of it's tasks.
*/
- public void setXDMTypedValueOf$value(Element rootNodeOfAssertTree, String
value, XSSimpleTypeDefinition listOrUnionType, XSTypeDefinition attrType,
boolean isTypeDerivedFromList, DynamicContext xpath2DynamicContext) throws
Exception {
+ public void setXDMTypedValueOf$value(Element rootNodeOfAssertTree, String
value, XSSimpleTypeDefinition listOrUnionType,
+ XSTypeDefinition attrType, boolean
isTypeDerivedFromList,
+ DynamicContext xpath2DynamicContext)
throws Exception {
// dummy schema short code initializer
short xsdTypecode = -100;
if (listOrUnionType != null) {
if (isTypeDerivedFromList || listOrUnionType.getVariety() ==
XSSimpleTypeDefinition.VARIETY_LIST) {
- // $value is a sequence of atomic values (with type annotation
xs:anyAtomicType*). tokenize the list value by a sequence of white spaces.
+ // $value is a sequence of atomic values (with type annotation
xs:anyAtomicType*).
+ // tokenize the list value by a sequence of white spaces.
StringTokenizer listStrTokens = new StringTokenizer(value, "
\n\t\r");
List xdmItemList = new ArrayList();
while (listStrTokens.hasMoreTokens()) {
@@ -136,7 +141,8 @@ public class XSAssertionXPath2ValueImpl
xdmItemList.add(SchemaTypeValueFactory.newSchemaTypeValue(listOrUnionType.getBuiltInKind(),
itemValue));
}
}
- xpath2DynamicContext.set_variable(new
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"),
XS11TypeHelper.getXPath2ResultSequence(xdmItemList));
+ xpath2DynamicContext.set_variable(new
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"),
+
XS11TypeHelper.getXPath2ResultSequence(xdmItemList));
}
else {
xsdTypecode = getXercesXSDTypeCodeFor$value(listOrUnionType);
@@ -157,7 +163,8 @@ public class XSAssertionXPath2ValueImpl
}
else if (typeDef instanceof XSComplexTypeDefinition &&
((XSComplexTypeDefinition) typeDef).getSimpleType() == null) {
// set xpath context variable $value to an empty sequence
- xpath2DynamicContext.set_variable(new
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"),
XS11TypeHelper.getXPath2ResultSequence(new ArrayList()));
+ xpath2DynamicContext.set_variable(new
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"),
+
XS11TypeHelper.getXPath2ResultSequence(new ArrayList()));
}
else {
xsdTypecode = getXercesXSDTypeCodeFor$value(typeDef);
@@ -170,18 +177,23 @@ public class XSAssertionXPath2ValueImpl
/*
- * Given a string value, this method sets an XPath 2.0 typed value for
variable "$value" in XPath dynamic context, when the value is for simpleType
variety atomic.
+ * Given a string value, this method sets an XPath 2.0 typed value for
variable "$value" in XPath dynamic context,
+ * when the value is for simpleType variety atomic.
*/
public void setXDMTypedValueOf$valueForSTVarietyAtomic(String value, short
xsdTypecode, DynamicContext xpath2DynamicContext) {
- AnyType psychoPathType =
SchemaTypeValueFactory.newSchemaTypeValue(xsdTypecode, value);
- xpath2DynamicContext.set_variable(new
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"),
(AnyAtomicType) psychoPathType);
+ AnyType eclipsePathType =
SchemaTypeValueFactory.newSchemaTypeValue(xsdTypecode, value);
+ xpath2DynamicContext.set_variable(new
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"),
+ (AnyAtomicType) eclipsePathType);
} // setXDMTypedValueOf$valueForSTVarietyAtomic
/*
- * Given a string value, this method sets an XPath 2.0 typed value for
variable "$value" in XPath dynamic context, when the value is for simpleType
variety list.
+ * Given a string value, this method sets an XPath 2.0 typed value for
variable "$value" in XPath dynamic context,
+ * when the value is for simpleType variety list.
*/
- public void setXDMTypedValueOf$valueForSTVarietyList(Element
rootNodeOfAssertTree, String listStrValue, XSSimpleTypeDefinition itemType,
boolean isTypeDerivedFromList, DynamicContext xpath2DynamicContext) throws
Exception {
+ public void setXDMTypedValueOf$valueForSTVarietyList(Element
rootNodeOfAssertTree, String listStrValue,
+
XSSimpleTypeDefinition itemType, boolean isTypeDerivedFromList,
+ DynamicContext
xpath2DynamicContext) throws Exception {
if (itemType.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION) {
// itemType of xs:list has variety 'union'
@@ -194,7 +206,8 @@ public class XSAssertionXPath2ValueImpl
XSSimpleTypeDefinition listItemTypeForUnion =
getActualXDMItemTypeForSTVarietyUnion(memberTypes, itemValue);
xdmItemList.add(SchemaTypeValueFactory.newSchemaTypeValue(listItemTypeForUnion.getBuiltInKind(),
itemValue));
}
- xpath2DynamicContext.set_variable(new
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"),
XS11TypeHelper.getXPath2ResultSequence(xdmItemList));
+ xpath2DynamicContext.set_variable(new
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"),
+
XS11TypeHelper.getXPath2ResultSequence(xdmItemList));
}
else {
setXDMTypedValueOf$value(rootNodeOfAssertTree, listStrValue,
itemType, null, isTypeDerivedFromList, xpath2DynamicContext);
@@ -204,16 +217,20 @@ public class XSAssertionXPath2ValueImpl
/*
- * Given a string value, this method sets an XPath 2.0 typed value for
variable "$value" in XPath dynamic context, when the value is for simpleType
with variety union.
+ * Given a string value, this method sets an XPath 2.0 typed value for
variable "$value" in XPath dynamic context,
+ * when the value is for simpleType with variety union.
*/
- public void setXDMTypedValueOf$valueForSTVarietyUnion(String value,
XSObjectList memberTypes, DynamicContext xpath2DynamicContext) throws Exception
{
+ public void setXDMTypedValueOf$valueForSTVarietyUnion(String value,
XSObjectList memberTypes,
+ DynamicContext
xpath2DynamicContext) throws Exception {
// check member types of union in order to find that which member type
can successfully validate the string value
// first, and set the type annotation of XPath2 context variable
$value with this member type definition.
for (int memTypeIdx = 0; memTypeIdx < memberTypes.getLength();
memTypeIdx++) {
XSSimpleType simpleTypeDv = (XSSimpleType)
memberTypes.item(memTypeIdx);
if (XS11TypeHelper.isStrValueValidForASimpleType(value,
simpleTypeDv, Constants.SCHEMA_VERSION_1_1)) {
if (simpleTypeDv.getVariety() ==
XSSimpleTypeDefinition.VARIETY_LIST) {
-
setXDMTypedValueOf$valueForSTVarietyList(fRootNodeOfAssertTree, value,
simpleTypeDv, ((XSSimpleTypeDefinition)simpleTypeDv.getBaseType()).getVariety()
== XSSimpleTypeDefinition.VARIETY_LIST, xpath2DynamicContext);
+
setXDMTypedValueOf$valueForSTVarietyList(fRootNodeOfAssertTree, value,
simpleTypeDv,
+
((XSSimpleTypeDefinition)simpleTypeDv.getBaseType()).getVariety() ==
XSSimpleTypeDefinition.VARIETY_LIST,
+
xpath2DynamicContext);
}
else {
setXDMTypedValueOf$valueForSTVarietyAtomic(value,
getXercesXSDTypeCodeFor$value(simpleTypeDv), xpath2DynamicContext);
@@ -225,16 +242,19 @@ public class XSAssertionXPath2ValueImpl
/*
- * Given a string value, this method sets an XPath 2.0 typed value for
variable "$value" in XPath dynamic context, if element has a complex type with
simple content.
+ * Given a string value, this method sets an XPath 2.0 typed value for
variable "$value" in XPath dynamic context,
+ * if element has a complex type with simple content.
*/
- protected void setXDMValueOf$valueForCTWithSimpleContent(String value,
XSComplexTypeDefinition typeDef, DynamicContext xpath2DynamicContext) throws
Exception {
+ protected void setXDMValueOf$valueForCTWithSimpleContent(String value,
XSComplexTypeDefinition typeDef,
+ DynamicContext
xpath2DynamicContext) throws Exception {
XSComplexTypeDefinition cmplxTypeDef =
(XSComplexTypeDefinition)typeDef;
XSSimpleTypeDefinition complexTypeSimplContentType =
cmplxTypeDef.getSimpleType();
if (complexTypeSimplContentType.getVariety() ==
XSSimpleTypeDefinition.VARIETY_LIST) {
// simple content type has variety xs:list
XSSimpleTypeDefinition listItemType =
complexTypeSimplContentType.getItemType();
- // $value is a sequence of atomic values (with type annotation
xs:anyAtomicType*). tokenize the list value by a sequence of white spaces.
+ // $value is a sequence of atomic values (with type annotation
xs:anyAtomicType*).
+ // tokenize the list value by a sequence of white spaces.
StringTokenizer values = new StringTokenizer(value, " \n\t\r");
List xdmItemList = new ArrayList();
if (listItemType.getVariety() ==
XSSimpleTypeDefinition.VARIETY_UNION) {
@@ -255,13 +275,16 @@ public class XSAssertionXPath2ValueImpl
}
// assign an XPath2 sequence to xpath context variable $value
- xpath2DynamicContext.set_variable(new
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"),
XS11TypeHelper.getXPath2ResultSequence(xdmItemList));
+ xpath2DynamicContext.set_variable(new
org.eclipse.wst.xml.xpath2.processor.internal.types.QName("value"),
+
XS11TypeHelper.getXPath2ResultSequence(xdmItemList));
}
else if (complexTypeSimplContentType.getVariety() ==
XSSimpleTypeDefinition.VARIETY_UNION) {
// simple content type has variety xs:union
XSSimpleTypeDefinition simpleContentTypeForUnion =
getActualXDMItemTypeForSTVarietyUnion(complexTypeSimplContentType.getMemberTypes(),
value);
if (simpleContentTypeForUnion.getVariety() ==
XSSimpleTypeDefinition.VARIETY_LIST) {
-
setXDMTypedValueOf$valueForSTVarietyList(fRootNodeOfAssertTree, value,
simpleContentTypeForUnion,
((XSSimpleTypeDefinition)simpleContentTypeForUnion.getBaseType()).getVariety()
== XSSimpleTypeDefinition.VARIETY_LIST, xpath2DynamicContext);
+
setXDMTypedValueOf$valueForSTVarietyList(fRootNodeOfAssertTree, value,
simpleContentTypeForUnion,
+
((XSSimpleTypeDefinition)simpleContentTypeForUnion.getBaseType()).getVariety()
== XSSimpleTypeDefinition.VARIETY_LIST,
+ xpath2DynamicContext);
}
else {
setXDMTypedValueOf$valueForSTVarietyAtomic(value,
getXercesXSDTypeCodeFor$value(simpleContentTypeForUnion), xpath2DynamicContext);
@@ -276,8 +299,8 @@ public class XSAssertionXPath2ValueImpl
/*
- * Find the built-in Xerces schema 'type code' for XPath2 variable $value.
This function recursively searches the XML schema type hierarchy navigating
- * up the base types, to find the needed built-in type.
+ * Find the built-in Xerces schema 'type code' for XPath2 variable $value.
This function recursively searches the XML schema
+ * type hierarchy navigating up the base types, to find the needed
built-in type.
*/
private short getXercesXSDTypeCodeFor$value(XSTypeDefinition elementType) {
@@ -286,7 +309,8 @@ public class XSAssertionXPath2ValueImpl
boolean isxsd11Type = false;
- // the below 'if else' clauses are written to process few special
cases handling few of schema types within PsychoPath XPath engine
+ // the following 'if else' clauses are written to process few
special cases,
+ // handling few of schema types within Eclipse XPath engine
final String elementTypeName = elementType.getName();
if ("dayTimeDuration".equals(elementTypeName)) {
typeCode = PsychoPathXPathTypeHelper.DAYTIMEDURATION_DT;
@@ -313,7 +337,8 @@ public class XSAssertionXPath2ValueImpl
XSSimpleTypeDefinition xdmItemType = null;
- // iterate the member types of union in order, to find that which
schema type can successfully validate an atomic value first
+ // iterate the member types of union in order, to find that which
schema type can successfully
+ // validate an atomic value first
final int memberTypesLength = memberTypes.getLength();
for (int memTypeIdx = 0; memTypeIdx < memberTypesLength; memTypeIdx++)
{
XSSimpleType memSimpleType = (XSSimpleType)
memberTypes.item(memTypeIdx);
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java?rev=1890307&r1=1890306&r2=1890307&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDTypeAlternativeTraverser.java
Sat May 29 09:07:37 2021
@@ -24,7 +24,7 @@ import org.apache.xerces.impl.Constants;
import org.apache.xerces.impl.dv.XSSimpleType;
import org.apache.xerces.impl.xpath.XPath20;
import org.apache.xerces.impl.xpath.XPathException;
-import org.apache.xerces.impl.xs.AbstractPsychoPathXPath2Impl;
+import org.apache.xerces.impl.xs.AbstractXPath2EngineImpl;
import org.apache.xerces.impl.xs.SchemaGrammar;
import org.apache.xerces.impl.xs.SchemaSymbols;
import org.apache.xerces.impl.xs.XSAnnotationImpl;
@@ -180,7 +180,8 @@ class XSDTypeAlternativeTraverser extend
if
(!fSchemaHandler.fXSConstraints.checkTypeDerivationOk(alternativeType,
element.fType, block)) {
reportSchemaError(
"e-props-correct.7",
- new Object[] {element.getName(),
XS11TypeHelper.getSchemaTypeName(alternativeType),
XS11TypeHelper.getSchemaTypeName(element.fType)},
+ new Object[] {element.getName(),
XS11TypeHelper.getSchemaTypeName(alternativeType),
+
XS11TypeHelper.getSchemaTypeName(element.fType)},
altElement);
// fall back to element declaration's type
alternativeType = element.fType;
@@ -188,9 +189,9 @@ class XSDTypeAlternativeTraverser extend
}
// not expecting any more children
- if (childNode != null) {
- //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);
+ if (childNode != null) {
+ reportSchemaError("s4s-elt-must-match.1", new Object[]{"type
alternative", "(annotation?, (simpleType | complexType)?)",
+
DOMUtil.getLocalName(childNode)}, childNode);
}
// create type alternative component
@@ -201,19 +202,22 @@ class XSDTypeAlternativeTraverser extend
Test testExpr = null;
try {
if (fIsFullXPathModeForCTA) {
- // if full XPath 2.0 support is enabled for CTA, use
PsychoPath XPath 2.0 engine for XPath evaluation
+ // if full XPath 2.0 support is enabled for CTA, use
Eclipse XPath 2.0 engine for XPath evaluation
XPathParser xpp = new JFlexCupParser();
XPath xp = xpp.parse("boolean(" + testStr + ")", true);
- Map psychoPathParams = new HashMap();
- psychoPathParams.put(Constants.XPATH2_NAMESPACE_CONTEXT,
schemaDoc.fNamespaceSupport);
- AbstractPsychoPathXPath2Impl abstractPsychoPathInst = new
AbstractPsychoPathXPath2Impl();
- StaticChecker name_check = new
StaticNameResolver(abstractPsychoPathInst.initXPath2DynamicContext(null, null,
psychoPathParams));
+ Map eclipseXpathParams = new HashMap();
+ eclipseXpathParams.put(Constants.XPATH2_NAMESPACE_CONTEXT,
schemaDoc.fNamespaceSupport);
+ AbstractXPath2EngineImpl abstractXpathEngineImpl = new
AbstractXPath2EngineImpl();
+ StaticChecker name_check = new
StaticNameResolver(abstractXpathEngineImpl.initXPath2DynamicContext(null, null,
+
eclipseXpathParams));
name_check.check(xp);
testExpr = new Test(xp, testStr, typeAlternative,
schemaDoc.fNamespaceSupport);
}
else {
// if XPath subset is enabled for CTA (this is also the
default option), use Xerces native XPath parser for CTA
- testExpr = new Test(new XPath20(testStr, fSymbolTable, new
NamespaceSupport(schemaDoc.fNamespaceSupport)), typeAlternative, new
NamespaceSupport(schemaDoc.fNamespaceSupport));
+ testExpr = new Test(new XPath20(testStr, fSymbolTable, new
NamespaceSupport(schemaDoc.fNamespaceSupport)),
+
typeAlternative,
+
new NamespaceSupport(schemaDoc.fNamespaceSupport));
}
}
catch (XPathException e) {
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XS11TypeHelper.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XS11TypeHelper.java?rev=1890307&r1=1890306&r2=1890307&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XS11TypeHelper.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XS11TypeHelper.java
Sat May 29 09:07:37 2021
@@ -99,10 +99,12 @@ public class XS11TypeHelper {
/*
- * Determine if a string value is valid with respect to any of the
simpleType -> union's member types which are in XML Schema namespace.
- * If this method returns a boolean 'true', then the value is valid with
respect to entire union schema component.
+ * Determine if a string value is valid with respect to any of the
simpleType -> union's member types which
+ * are in XML Schema namespace. If this method returns a boolean 'true',
then the value is valid with respect
+ * to entire union schema component.
*/
- public static boolean isAtomicStrValueValidForSTUnion(XSObjectList
memberTypes, String content, ValidatedInfo validatedInfo, short schemaVersion) {
+ public static boolean isAtomicStrValueValidForSTUnion(XSObjectList
memberTypes, String content,
+ ValidatedInfo
validatedInfo, short schemaVersion) {
boolean isValueValid = false;
@@ -110,7 +112,8 @@ public class XS11TypeHelper {
// to the 1st available type in union's member type collection, is
sufficient to achieve the objective of this method.
for (int memTypeIdx = 0; memTypeIdx < memberTypes.getLength();
memTypeIdx++) {
XSSimpleType simpleTypeDv = (XSSimpleType)
memberTypes.item(memTypeIdx);
- if
(SchemaSymbols.URI_SCHEMAFORSCHEMA.equals(simpleTypeDv.getNamespace()) &&
XS11TypeHelper.isStrValueValidForASimpleType(content, simpleTypeDv,
schemaVersion)) {
+ if
(SchemaSymbols.URI_SCHEMAFORSCHEMA.equals(simpleTypeDv.getNamespace()) &&
+
XS11TypeHelper.isStrValueValidForASimpleType(content, simpleTypeDv,
schemaVersion)) {
isValueValid = true;
validatedInfo.memberType = simpleTypeDv;
break;
@@ -123,7 +126,8 @@ public class XS11TypeHelper {
/*
- * Determine if a string value is valid with a given simpleType
definition. Using Xerces API 'XSSimpleType.validate' for this need.
+ * Determine if a string value is valid with a given simpleType
definition.
+ * Using Xerces API 'XSSimpleType.validate' for this need.
*/
public static boolean isStrValueValidForASimpleType(String value,
XSSimpleType simplType, short schemaVersion) {
@@ -148,7 +152,8 @@ public class XS11TypeHelper {
/*
- * Validate a QName value (check lexical form for correctness, and if the
prefix is declared), and report errors if there are any.
+ * Validate a QName value (check lexical form for correctness, and whether
the prefix is declared),
+ * and report any possible errors.
*/
public static void validateQNameValue(String qNameStr, NamespaceContext
namespaceContext, XMLErrorReporter errorReporter) {
@@ -158,13 +163,15 @@ public class XS11TypeHelper {
// both prefix (if any) and localpart of QName, must be valid NCName
if ((prefix.length() > 0 && !XMLChar.isValidNCName(prefix)) ||
!XMLChar.isValidNCName(localpart)) {
- errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
"cvc-datatype-valid.1.2.1", new Object[] {qNameStr, "QName"},
XMLErrorReporter.SEVERITY_ERROR);
+ errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
"cvc-datatype-valid.1.2.1",
+ new Object[] {qNameStr, "QName"},
XMLErrorReporter.SEVERITY_ERROR);
}
// try to resolve QName prefix to a namespace URI, and report an error
if resolution fails.
String uri = namespaceContext.getURI(prefix.intern());
if (prefix.length() > 0 && uri == null) {
- errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
"UndeclaredPrefix", new Object[] {qNameStr, prefix},
XMLErrorReporter.SEVERITY_ERROR);
+ errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
"UndeclaredPrefix",
+ new Object[] {qNameStr, prefix},
XMLErrorReporter.SEVERITY_ERROR);
}
} // validateQNameValue
@@ -290,7 +297,8 @@ public class XS11TypeHelper {
public static boolean isSpecialSimpleType(XSSimpleType simpleType) {
boolean isSpecialSimpleType = false;
String typeName = simpleType.getName();
- if (Constants.NS_XMLSCHEMA.equals(simpleType.getNamespace()) &&
(SchemaSymbols.ATTVAL_ANYATOMICTYPE.equals(typeName) ||
SchemaSymbols.ATTVAL_ANYSIMPLETYPE.equals(typeName))) {
+ if (Constants.NS_XMLSCHEMA.equals(simpleType.getNamespace()) &&
(SchemaSymbols.ATTVAL_ANYATOMICTYPE.equals(typeName) ||
+
SchemaSymbols.ATTVAL_ANYSIMPLETYPE.equals(typeName))) {
isSpecialSimpleType = true;
}
return isSpecialSimpleType;
@@ -298,7 +306,7 @@ public class XS11TypeHelper {
/*
- * Construct an PsychoPath XPath2 "result sequence" given a list of XDM
items as input.
+ * Construct an Eclipse XPath2 "result sequence" given a list of XDM items
as input.
*/
public static ResultSequence getXPath2ResultSequence(List xdmItems) {
@@ -314,7 +322,7 @@ public class XS11TypeHelper {
/*
- * Check if two type tables can be compared.
+ * Check if two type tables can be compared, for the purpose of XSD CTA
evaluation.
*/
public static boolean isTypeTablesComparable(XSTypeAlternativeImpl[]
typeTable1, XSTypeAlternativeImpl[] typeTable2) {
boolean typeTablesComparable = true;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]