You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by mu...@apache.org on 2010/11/29 01:18:50 UTC
svn commit: r1039990 - in
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs:
AbstractPsychoPathImpl.java XMLAssertPsychopathImpl.java
Author: mukulg
Date: Mon Nov 29 00:18:50 2010
New Revision: 1039990
URL: http://svn.apache.org/viewvc?rev=1039990&view=rev
Log:
doing slight refactoring and code indentation. sorry that this is late commit for 2.11.0 release.
Modified:
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java?rev=1039990&r1=1039989&r2=1039990&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/AbstractPsychoPathImpl.java Mon Nov 29 00:18:50 2010
@@ -49,8 +49,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
- * A base class providing common services for XPath expression evaluation,
- * with 'PsychoPath XPath 2.0' engine.
+ * A base class providing common services for XPath expression evaluation, with
+ * 'PsychoPath XPath 2.0' engine.
*
* @xerces.internal
*
@@ -66,16 +66,12 @@ public class AbstractPsychoPathImpl {
/*
* Initialize the 'PsychoPath XPath 2' dynamic context.
*/
- protected DynamicContext initDynamicContext(XSModel schema,
- Document document,
- Map psychoPathParams) {
+ protected DynamicContext initDynamicContext(XSModel schema, Document document, Map psychoPathParams) {
fDynamicContext = 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("XPATH2_NS_CONTEXT");
+ // populate the 'PsychoPath XPath 2' static context, with namespace bindings derived from the XML Schema document.
+ NamespaceSupport xpath2NamespaceContext = (NamespaceSupport) psychoPathParams.get("XPATH2_NS_CONTEXT");
Enumeration currPrefixes = xpath2NamespaceContext.getAllPrefixes();
while (currPrefixes.hasMoreElements()) {
String prefix = (String)currPrefixes.nextElement();
@@ -89,17 +85,14 @@ public class AbstractPsychoPathImpl {
return fDynamicContext;
- } //initDynamicContext
+ } // initDynamicContext
/*
* Evaluate XPath expression with PsychoPath engine.
*/
- protected boolean evaluatePsychoPathExpr(XPath xp,
- String xPathDefaultNamespace,
- Element contextNode)
- throws StaticError, DynamicError,
- Exception {
+ protected boolean evaluateXPathExpr(XPath xp, String xPathDefaultNamespace, Element contextNode)
+ throws StaticError, DynamicError, Exception {
StaticChecker sc = new StaticNameResolver(fDynamicContext);
sc.check(xp);
@@ -109,8 +102,7 @@ public class AbstractPsychoPathImpl {
eval = new DefaultEvaluator(fDynamicContext, domDoc);
// change focus to the top most element
ResultSequence nodeEvalRS = ResultSequenceFactory.create_new();
- nodeEvalRS.add(new ElementType(contextNode,
- fDynamicContext.node_position(contextNode)));
+ nodeEvalRS.add(new ElementType(contextNode, fDynamicContext.node_position(contextNode)));
if (xPathDefaultNamespace != null) {
fDynamicContext.add_namespace(null, xPathDefaultNamespace);
}
@@ -143,15 +135,13 @@ public class AbstractPsychoPathImpl {
return result;
- } //evaluatePsychoPathExpr
+ } // evaluateXPathExpr
/*
* Compile an XPath string, and return the compiled XPath expression.
*/
- protected XPath compileXPathStr(String xpathStr,
- XSAssertImpl assertImpl,
- XSDHandler fSchemaHandler) {
+ protected XPath compileXPathStr(String xpathStr, XSAssertImpl assertImpl, XSDHandler fSchemaHandler) {
XPathParser xpp = new JFlexCupParser();
XPath xp = null;
@@ -164,29 +154,25 @@ public class AbstractPsychoPathImpl {
return xp;
- } //compileXPathStr
+ } // compileXPathStr
/*
* Method to report error messages.
*/
- private void reportError(String key, XSAssertImpl assertImpl,
- XSDHandler fSchemaHandler) {
+ private void reportError(String key, XSAssertImpl assertImpl, XSDHandler fSchemaHandler) {
XSTypeDefinition typeDef = assertImpl.getTypeDefinition();
String typeString = "";
if (typeDef != null) {
- typeString = (typeDef.getName() != null) ? typeDef.getName() :
- "#anonymous";
+ typeString = (typeDef.getName() != null) ? typeDef.getName() : "#anonymous";
}
else {
typeString = "#anonymous";
}
- fSchemaHandler.reportSchemaError(key, new Object[] {
- assertImpl.getTest().getXPath().toString(),
- typeString }, null);
+ fSchemaHandler.reportSchemaError(key, new Object[] {assertImpl.getTest().getXPath().toString(), typeString }, null);
- } //reportError
+ } // reportError
} // class AbstractPsychoPathImpl
Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java?rev=1039990&r1=1039989&r2=1039990&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLAssertPsychopathImpl.java Mon Nov 29 00:18:50 2010
@@ -69,10 +69,9 @@ import org.w3c.dom.NodeList;
* This class interfaces with the "Eclipse/PsychoPath XPath 2.0" engine for XPath
* expression evaluations for XML Schema assertions.
*
- * The class here constructs Xerces PSVI enabled DOM trees -- "on which
- * PsychoPath XPath engine operates" (for typed XDM instance support) from
- * XNI event calls. XML Schema assertions are evaluated on these XPath tree
- * instances in a bottom up fashion.
+ * The class here constructs Xerces PSVI enabled DOM trees -- "on which PsychoPath XPath
+ * engine operates" (for typed XDM instance support) from XNI event calls. XML Schema
+ * assertions are evaluated on these XPath tree instances in a bottom up fashion.
*
* @xerces.internal
*
@@ -573,12 +572,12 @@ public class XMLAssertPsychopathImpl ext
boolean result;
if ((value == null) ||
(xPathContextExists == true)) {
- result = fAbstrPsychopathImpl.evaluatePsychoPathExpr(xp, assertImpl.getXPathDefaultNamespace(),
+ result = fAbstrPsychopathImpl.evaluateXPathExpr(xp, assertImpl.getXPathDefaultNamespace(),
fCurrentAssertDomNode);
}
else {
// XPath context is "undefined"
- result = fAbstrPsychopathImpl.evaluatePsychoPathExpr(xp, assertImpl.getXPathDefaultNamespace(),
+ result = fAbstrPsychopathImpl.evaluateXPathExpr(xp, assertImpl.getXPathDefaultNamespace(),
null);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org