Author: mukulg
Date: Fri Nov 4 16:07:45 2011
New Revision: 1197621
URL: http://svn.apache.org/viewvc?rev=1197621&view=rev
Log:
schema 1.1 commit:
it seemed to me that the class XPath20Assert in org.apache.xerces.impl.xpath
was superfluously modeled, and it's functionality could be made available in
class Test (in org.apache.xerces.impl.xs.assertion). this commit makes
improvement in this regard.
Removed:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20Assert.java
Modified:
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
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/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/traversers/XSDAbstractTraverser.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
Modified:
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/AbstractPsychoPathXPath2Impl.java?rev=1197621&r1=1197620&r2=1197621&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/AbstractPsychoPathXPath2Impl.java
Fri Nov 4 16:07:45 2011
@@ -164,10 +164,10 @@ public class AbstractPsychoPathXPath2Imp
} catch (XPathParserException ex) {
// error compiling XPath expression
if
(SchemaSymbols.ASSERT_XPATHEXPR_COMPILE_ERR_MESG_1.equals(ex.getMessage())) {
- fSchemaHandler.reportSchemaWarning("cvc-xpath.3.13.4.2b", new
Object[] {assertImpl.getTest().getXPath().toString(),
XSTypeHelper.getSchemaTypeName(assertImpl.getTypeDefinition())},
schemaContextElem);
+ fSchemaHandler.reportSchemaWarning("cvc-xpath.3.13.4.2b", new
Object[] {assertImpl.getTest().getXPathStr(),
XSTypeHelper.getSchemaTypeName(assertImpl.getTypeDefinition())},
schemaContextElem);
}
else {
- fSchemaHandler.reportSchemaError("cvc-xpath.3.13.4.2a", new
Object[] {assertImpl.getTest().getXPath().toString(),
XSTypeHelper.getSchemaTypeName(assertImpl.getTypeDefinition())},
schemaContextElem);
+ fSchemaHandler.reportSchemaError("cvc-xpath.3.13.4.2a", new
Object[] {assertImpl.getTest().getXPathStr(),
XSTypeHelper.getSchemaTypeName(assertImpl.getTypeDefinition())},
schemaContextElem);
}
}
Modified:
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/XMLAssertPsychopathXPath2Impl.java?rev=1197621&r1=1197620&r2=1197621&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/XMLAssertPsychopathXPath2Impl.java
Fri Nov 4 16:07:45 2011
@@ -718,12 +718,12 @@ public class XMLAssertPsychopathXPath2Im
else {
if (assertImpl.getAssertKind() == XSConstants.ASSERTION) {
// error for xs:assert component
- fXmlSchemaValidator.reportSchemaError(key, new Object[]
{elemNameAnnotation, assertImpl.getTest().getXPath().toString(), typeNameStr,
mesgSuffix});
+ fXmlSchemaValidator.reportSchemaError(key, new Object[]
{elemNameAnnotation, assertImpl.getTest().getXPathStr(), typeNameStr,
mesgSuffix});
}
else {
// errors for xs:assertion facet
- fXmlSchemaValidator.reportSchemaError("cvc-assertions-valid",
new Object[] {value, assertImpl.getTest().getXPath().toString(),
exceptionMesg});
- fXmlSchemaValidator.reportSchemaError(key, new Object[]
{elemNameAnnotation, assertImpl.getTest().getXPath().toString(), typeNameStr,
mesgSuffix});
+ fXmlSchemaValidator.reportSchemaError("cvc-assertions-valid",
new Object[] {value, assertImpl.getTest().getXPathStr(), exceptionMesg});
+ fXmlSchemaValidator.reportSchemaError(key, new Object[]
{elemNameAnnotation, assertImpl.getTest().getXPathStr(), typeNameStr,
mesgSuffix});
}
}
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/Test.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/Test.java?rev=1197621&r1=1197620&r2=1197621&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/Test.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/assertion/Test.java
Fri Nov 4 16:07:45 2011
@@ -17,7 +17,7 @@
package org.apache.xerces.impl.xs.assertion;
-import org.apache.xerces.impl.xpath.XPath20Assert;
+import org.apache.xerces.xni.NamespaceContext;
/**
* Representation of XML Schema 1.1 assertion "test" attribute.
@@ -29,28 +29,34 @@ import org.apache.xerces.impl.xpath.XPat
*/
public class Test {
+ /** The XPath expression string for the assertion component */
+ protected final String fExpressionStr;
+
+ /** The Namespace context information for assert component */
+ protected final NamespaceContext fNsContext;
+
/** The assertion component to which the test belongs */
protected final XSAssert fAssert;
- /** XPath 2.0 expression */
- protected final XPath20Assert fXPath;
-
/** Constructs a test for assertion component */
- public Test(XPath20Assert xpath, XSAssert assertion) {
- fXPath = xpath;
+ public Test(String xpathStr, NamespaceContext nsContext, XSAssert
assertion) {
+ fExpressionStr = xpathStr;
+ fNsContext = nsContext;
fAssert = assertion;
}
- public XSAssert getAssertion() {
- return fAssert;
+ /** Returns the test XPath string value */
+ public String getXPathStr() {
+ return fExpressionStr;
}
- /** Returns the test XPath */
- public XPath20Assert getXPath() {
- return fXPath;
+ /** Returns the namespace context for assertion component */
+ public NamespaceContext getNamespaceContext() {
+ return fNsContext;
}
-
- public String toString() {
- return fXPath.toString();
+
+ /** Returns the assertion component */
+ public XSAssert getAssertion() {
+ return fAssert;
}
}
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=1197621&r1=1197620&r2=1197621&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
Fri Nov 4 16:07:45 2011
@@ -91,7 +91,7 @@ public class XSAssertImpl extends Abstra
fTestExpr = expr;
// compile the XPath string, and keep compiled representation into
this object for later use (this helps us to
// optimize assertions evaluations).
- setCompiledExpr(compileXPathStr(expr.toString(), this, fSchemaHandler,
schemaContextElem));
+ setCompiledExpr(compileXPathStr(expr.getXPathStr(), this,
fSchemaHandler, schemaContextElem));
}
public void setCompiledExpr(XPath compiledXPathExpr) {
@@ -146,7 +146,7 @@ public class XSAssertImpl extends Abstra
}
public String getTestStr() {
- return fTestExpr.toString();
+ return fTestExpr.getXPathStr();
}
public XPath getCompiledXPathExpr() {
@@ -226,8 +226,8 @@ public class XSAssertImpl extends Abstra
boolean returnVal = false;
- String xpathStr = pAssertion.getTest().getXPath().toString();
- String currXpathStr = this.getTest().getXPath().toString();
+ String xpathStr = pAssertion.getTest().getXPathStr();
+ String currXpathStr = this.getTest().getXPathStr();
// if type and the xpath string are same, the asserts are equal
if
(XSTypeHelper.isSchemaTypesIdentical(pAssertion.getTypeDefinition(),
fTypeDefinition) &&
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java?rev=1197621&r1=1197620&r2=1197621&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDAbstractTraverser.java
Fri Nov 4 16:07:45 2011
@@ -25,7 +25,6 @@ import org.apache.xerces.impl.dv.Invalid
import org.apache.xerces.impl.dv.XSFacets;
import org.apache.xerces.impl.dv.XSSimpleType;
import org.apache.xerces.impl.validation.ValidationState;
-import org.apache.xerces.impl.xpath.XPath20Assert;
import org.apache.xerces.impl.xs.SchemaGrammar;
import org.apache.xerces.impl.xs.SchemaNamespaceSupport;
import org.apache.xerces.impl.xs.SchemaSymbols;
@@ -520,7 +519,7 @@ abstract class XSDAbstractTraverser {
// create an assertion object
XSAssertImpl assertImpl = new XSAssertImpl(typeDef,
annotations, fSchemaHandler);
- Test testExpr = new Test(new XPath20Assert(test, new
SchemaNamespaceSupport(schemaDoc.fNamespaceSupport)), assertImpl);
+ Test testExpr = new Test(test,
schemaDoc.fNamespaceSupport, assertImpl);
assertImpl.setAssertKind(XSConstants.ASSERTION_FACET);
assertImpl.setTest(testExpr, content);
assertImpl.setXPathDefaultNamespace(xpathDefaultNamespace);
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
URL:
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java?rev=1197621&r1=1197620&r2=1197621&view=diff
==============================================================================
---
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
(original)
+++
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
Fri Nov 4 16:07:45 2011
@@ -26,7 +26,6 @@ import org.apache.xerces.impl.dv.XSSimpl
import org.apache.xerces.impl.dv.xs.AnyURIDV;
import org.apache.xerces.impl.dv.xs.TypeValidator;
import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
-import org.apache.xerces.impl.xpath.XPath20Assert;
import org.apache.xerces.impl.xs.SchemaGrammar;
import org.apache.xerces.impl.xs.SchemaNamespaceSupport;
import org.apache.xerces.impl.xs.SchemaSymbols;
@@ -1730,7 +1729,7 @@ class XSDComplexTypeTraverser extends X
// create an assertion object
XSAssertImpl assertImpl = new XSAssertImpl(enclosingCT,
annotations, fSchemaHandler);
- Test testExpr = new Test(new XPath20Assert(test, new
SchemaNamespaceSupport(schemaDoc.fNamespaceSupport)), assertImpl);
+ Test testExpr = new Test(test, schemaDoc.fNamespaceSupport,
assertImpl);
String xpathDefaultNamespace =
getXPathDefaultNamespaceForAssert(assertElement, schemaDoc, attrValues);
assertImpl.setTest(testExpr, assertElement);
assertImpl.setXPathDefaultNamespace(xpathDefaultNamespace);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]