Author: mukulg
Date: Sun Feb 20 16:19:42 2011
New Revision: 1072622

URL: http://svn.apache.org/viewvc?rev=1072622&view=rev
Log:
committing few minor code indentation changes

Modified:
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDTypeAlternativeValidator.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/alternative/Test.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20.java?rev=1072622&r1=1072621&r2=1072622&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20.java
 Sun Feb 20 16:19:42 2011
@@ -31,8 +31,7 @@ import org.apache.xerces.xs.ShortList;
 import org.apache.xerces.xs.XSConstants;
 
 /**
- * Bare minimal XPath 2.0 implementation for schema
- * type alternatives.
+ * Bare minimal XPath 2.0 implementation for schema type alternatives.
  *
  * @author Hiranya Jayathilaka, University of Moratuwa
  * @version $Id$
@@ -44,8 +43,7 @@ public class XPath20 {
 
     private XPathSyntaxTreeNode fRootNode;
 
-    public XPath20(String xpath, SymbolTable symbolTable,
-            NamespaceContext context) throws XPathException {
+    public XPath20(String xpath, SymbolTable symbolTable, NamespaceContext 
context) throws XPathException {
         fExpression = xpath;
         fContext = context;
         
@@ -56,8 +54,7 @@ public class XPath20 {
     }
 
     /**
-     * Evaluate the test XPath expression using the attribute information and 
-     * element information.
+     * Evaluate the test XPath expression using the attribute information and 
element information.
      * 
      * @param element QName of the current element
      * @param attributes attributes collection of the current element
@@ -153,8 +150,7 @@ class ConjunctionNode extends XPathSynta
     public static final int OR = 0;
     public static final int AND = 1;
 
-    public ConjunctionNode(int conjunction, XPathSyntaxTreeNode child1,
-            XPathSyntaxTreeNode child2) {
+    public ConjunctionNode(int conjunction, XPathSyntaxTreeNode child1, 
XPathSyntaxTreeNode child2) {
         this.conjunction = conjunction;
         this.child1 = child1;
         this.child2 = child2;
@@ -430,15 +426,13 @@ class FunctionNode extends XPathSyntaxTr
 
 class DataMatcher {
 
-    public static boolean compareActualValues(Object value1, Object value2, 
int comparator,
-            XSSimpleTypeDecl type) {
+    public static boolean compareActualValues(Object value1, Object value2, 
int comparator, XSSimpleTypeDecl type) {
 
         TypeValidator typeValidator = type.getTypeValidator();
         short ordered = type.getOrdered();
 
         if (ordered == XSSimpleTypeDecl.ORDERED_FALSE) {
-            //if the type is not ordered then only equality can be tested
-            //delegate the test to the type
+            //if the type is not ordered then only equality can be tested. 
delegate the test to the type.
             if (comparator == CompNode.EQ) {
                 return type.isEqual(value1, value2);
             }
@@ -451,26 +445,25 @@ class DataMatcher {
             }
         }
 
-        //if the type is ordered then the corresponding TypeValidator should
-        //know how to compare the values
+        //if the type is ordered then the corresponding TypeValidator should 
know how to compare the values
         switch (comparator) {
-
-        case CompNode.EQ: return typeValidator.compare(value1, value2) == 0;
-        case CompNode.NE: return typeValidator.compare(value1, value2) != 0;
-        case CompNode.GT: return typeValidator.compare(value1, value2) > 0;
-        case CompNode.GE: return typeValidator.compare(value1, value2) >= 0;
-        case CompNode.LT: return typeValidator.compare(value1, value2) < 0;
-        case CompNode.LE: return typeValidator.compare(value1, value2) <= 0;
+           case CompNode.EQ: return typeValidator.compare(value1, value2) == 0;
+           case CompNode.NE: return typeValidator.compare(value1, value2) != 0;
+           case CompNode.GT: return typeValidator.compare(value1, value2) > 0;
+           case CompNode.GE: return typeValidator.compare(value1, value2) >= 0;
+           case CompNode.LT: return typeValidator.compare(value1, value2) < 0;
+           case CompNode.LE: return typeValidator.compare(value1, value2) <= 0;
         }
+        
         return false;
+        
     }
 
     /**
      * Checks whether two specified data types are comparable. The types passed
      * into this method should be defined in XSConstants as *_DT values.
      */
-    public static boolean isComparable(short type1, short type2,
-            ShortList typeList1, ShortList typeList2) {
+    public static boolean isComparable(short type1, short type2, ShortList 
typeList1, ShortList typeList2) {
 
         short primitiveType1 = convertToPrimitiveKind(type1);
         short primitiveType2 = convertToPrimitiveKind(type2);
@@ -516,6 +509,7 @@ class DataMatcher {
         // Other types
         return valueType;
     }
-}
+    
+} // class XPath20
 
 

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java?rev=1072622&r1=1072621&r2=1072622&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidator.java
 Sun Feb 20 16:19:42 2011
@@ -1361,7 +1361,7 @@ public class XMLSchemaValidator
     
     // variable to track validity of simple content for union types. if a 
member type of union in XML Schema namespace, can
     // successfully validate (in a preprocess step in this class) an atomic 
value, we don't process assertions for such union types.
-    private boolean fisAssertProcessingNeededForSTUnion = true;
+    private boolean fIsAssertProcessingNeededForSTUnion = true;
     
     // 'type alternative' validator subcomponent
     private XSDTypeAlternativeValidator fTypeAlternativeValidator = null;
@@ -2177,8 +2177,7 @@ public class XMLSchemaValidator
 
         //process type alternatives
         if (fTypeAlternativesChecking && fCurrentElemDecl != null) {
-            XSTypeDefinition currentType = 
fTypeAlternativeValidator.getCurrentType(fCurrentElemDecl, 
-                                                                               
     element, attributes);           
+           XSTypeDefinition currentType = 
fTypeAlternativeValidator.getCurrentType(fCurrentElemDecl, element, 
attributes);           
            if (currentType != null) {
                fCurrentType = currentType;    
            }
@@ -2574,8 +2573,8 @@ public class XMLSchemaValidator
         // delegate to assertions validator subcomponent
         if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
             fAssertionValidator.handleEndElement(element, fCurrentElemDecl, 
fCurrentType, fNotation, 
-                                                 fGrammarBucket, 
fisAssertProcessingNeededForSTUnion);
-            fisAssertProcessingNeededForSTUnion = true;
+                                                 fGrammarBucket, 
fIsAssertProcessingNeededForSTUnion);
+            fIsAssertProcessingNeededForSTUnion = true;
         }
 
         // Check if we should modify the xsi:type ignore depth
@@ -3260,7 +3259,7 @@ public class XMLSchemaValidator
             if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1 && 
attDV.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION && 
                                       ((XSSimpleType) 
attDV.getBaseType()).getVariety() != XSSimpleTypeDefinition.VARIETY_UNION) {
                 if 
(XSTypeHelper.isAtomicValueValidForAnUnion(attDV.getMemberTypes(), attrValue, 
null)) {
-                    fisAssertProcessingNeededForSTUnion = false; 
+                    fIsAssertProcessingNeededForSTUnion = false; 
                 }
             }
             
@@ -3286,7 +3285,7 @@ public class XMLSchemaValidator
             }
         } 
         catch (InvalidDatatypeValueException idve) {
-            fisAssertProcessingNeededForSTUnion = false;
+            fIsAssertProcessingNeededForSTUnion = false;
             reportSchemaError(idve.getKey(), idve.getArgs());
             reportSchemaError(
                 "cvc-attribute.3",
@@ -3414,12 +3413,12 @@ public class XMLSchemaValidator
                     if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1 && 
attDV.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION && 
                                               ((XSSimpleType) 
attDV.getBaseType()).getVariety() != XSSimpleTypeDefinition.VARIETY_UNION) {
                         if 
(XSTypeHelper.isAtomicValueValidForAnUnion(attDV.getMemberTypes(), null, 
defaultValue)) {
-                            fisAssertProcessingNeededForSTUnion = false; 
+                            fIsAssertProcessingNeededForSTUnion = false; 
                         }
                     }
                 } 
                 catch (InvalidDatatypeValueException idve) {
-                    fisAssertProcessingNeededForSTUnion = false;
+                    fIsAssertProcessingNeededForSTUnion = false;
                     reportSchemaError(idve.getKey(), idve.getArgs());
                 }
                 fValidationState.setFacetChecking(facetChecking);
@@ -3626,11 +3625,11 @@ public class XMLSchemaValidator
                     if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1 && 
dv.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION && 
                                               ((XSSimpleType) 
dv.getBaseType()).getVariety() != XSSimpleTypeDefinition.VARIETY_UNION) {
                         if 
(XSTypeHelper.isAtomicValueValidForAnUnion(dv.getMemberTypes(), 
String.valueOf(textContent), null)) {
-                            fisAssertProcessingNeededForSTUnion = false; 
+                            fIsAssertProcessingNeededForSTUnion = false; 
                         }
                     }
                 } catch (InvalidDatatypeValueException e) {
-                    fisAssertProcessingNeededForSTUnion = false;
+                    fIsAssertProcessingNeededForSTUnion = false;
                     reportSchemaError(e.getKey(), e.getArgs());
                     reportSchemaError(
                         "cvc-type.3.1.3",
@@ -3674,11 +3673,11 @@ public class XMLSchemaValidator
                     if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1 && 
dv.getVariety() == XSSimpleTypeDefinition.VARIETY_UNION && 
                                               ((XSSimpleType) 
dv.getBaseType()).getVariety() != XSSimpleTypeDefinition.VARIETY_UNION) {
                         if 
(XSTypeHelper.isAtomicValueValidForAnUnion(dv.getMemberTypes(), 
String.valueOf(textContent), null)) {
-                            fisAssertProcessingNeededForSTUnion = false; 
+                            fIsAssertProcessingNeededForSTUnion = false; 
                         }
                     }
                 } catch (InvalidDatatypeValueException e) {
-                    fisAssertProcessingNeededForSTUnion = false;
+                    fIsAssertProcessingNeededForSTUnion = false;
                     reportSchemaError(e.getKey(), e.getArgs());
                     reportSchemaError("cvc-complex-type.2.2", new Object[] { 
element.rawname });
                 }

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDTypeAlternativeValidator.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDTypeAlternativeValidator.java?rev=1072622&r1=1072621&r2=1072622&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDTypeAlternativeValidator.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XSDTypeAlternativeValidator.java
 Sun Feb 20 16:19:42 2011
@@ -44,7 +44,7 @@ public class XSDTypeAlternativeValidator
     // a Vector list storing inheritable attributes
     private Vector fInheritableAttrList = new Vector();
     
-    // a Stack, storing inheritable attribute count for the elements
+    // a Stack storing inheritable attribute count for the elements
     private IntStack fInhrAttrCountStack = new IntStack();
     
     // temporary qname
@@ -67,16 +67,16 @@ public class XSDTypeAlternativeValidator
         XSTypeDefinition currentType = null;        
         boolean typeSelected = false;
         
-        XSTypeAlternativeImpl[] alternatives = 
currentElemDecl.getTypeAlternatives();
+        XSTypeAlternativeImpl[] typeAlternatives = 
currentElemDecl.getTypeAlternatives();
         
-        if (alternatives != null) {              
+        if (typeAlternatives != 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();
+            for (int typeAltIdx = 0; typeAltIdx < typeAlternatives.length; 
typeAltIdx++) {
+                Test test = typeAlternatives[typeAltIdx].getTest();
                 if (test != null && test.evaluateTest(element, ctaAttributes)) 
{
-                    currentType = alternatives[i].getTypeDefinition();
+                    currentType = 
typeAlternatives[typeAltIdx].getTypeDefinition();
                     typeSelected = true;
                     break;
                 }
@@ -131,28 +131,27 @@ public class XSDTypeAlternativeValidator
      */
     private XMLAttributes getAttributesForCTA(XMLAttributes attributes) {
 
-      // copy attributes from the original list of attributes
-      XMLAttributes ctaAttributes = new XMLAttributesImpl();
-      for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) {
-         QName qName = new QName();
-         attributes.getName(attrIndx, qName);
-         ctaAttributes.addAttribute(qName, attributes.getType(attrIndx), 
attributes.getValue(attrIndx));   
-      }
-      
-      // Traverse up the XML tree, to find inheritable attributes. Attributes 
only from the nearest ancestor,
-      // are added to the list (since there is recursive inclusion of 
inheritable attributes in an XML tree).
-      for (int elemIndx = fInheritableAttrList.size() - 1; elemIndx > -1; 
elemIndx--) {        
-         InheritableAttribute inhAttr = (InheritableAttribute) 
fInheritableAttrList.elementAt(elemIndx);
-         // if an inheritable attribute doesn't already exist in the 
attributes list, add it to the list
-         if (!attributeExists(ctaAttributes, inhAttr)) {
-            String rawName = "".equals(inhAttr.getPrefix()) ? 
inhAttr.getLocalName() : inhAttr.getPrefix() + ":" + 
-                                       inhAttr.getLocalName(); 
-            fTempQName.setValues(inhAttr.getPrefix(), inhAttr.getLocalName(), 
rawName, inhAttr.getUri());
-            ctaAttributes.addAttribute(fTempQName, inhAttr.getType(), 
inhAttr.getValue());
-         }
-      }
-      
-      return ctaAttributes;
+        // copy attributes from the original list of attributes
+        XMLAttributes ctaAttributes = new XMLAttributesImpl();
+        for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) {
+            QName qName = new QName();
+            attributes.getName(attrIndx, qName);
+            ctaAttributes.addAttribute(qName, attributes.getType(attrIndx), 
attributes.getValue(attrIndx));   
+        }
+
+        // Traverse up the XML tree, to find inheritable attributes. 
Attributes only from the nearest ancestor,
+        // are added to the list (since there is recursive inclusion of 
inheritable attributes in an XML tree).
+        for (int elemIndx = fInheritableAttrList.size() - 1; elemIndx > -1; 
elemIndx--) {        
+            InheritableAttribute inhAttr = (InheritableAttribute) 
fInheritableAttrList.elementAt(elemIndx);
+            // if an inheritable attribute doesn't already exist in the 
attributes list, add it to the list
+            if (!attributeExists(ctaAttributes, inhAttr)) {
+                String rawName = "".equals(inhAttr.getPrefix()) ? 
inhAttr.getLocalName() : inhAttr.getPrefix() + ":" + inhAttr.getLocalName(); 
+                fTempQName.setValues(inhAttr.getPrefix(), 
inhAttr.getLocalName(), rawName, inhAttr.getUri());
+                ctaAttributes.addAttribute(fTempQName, inhAttr.getType(), 
inhAttr.getValue());
+            }
+        }
+
+        return ctaAttributes;
       
     } // getAttributesForCTA
     
@@ -163,31 +162,30 @@ public class XSDTypeAlternativeValidator
      */
     private void saveInheritableAttributes(XSElementDecl currentElemDecl, 
XMLAttributes attributes) {
        
-       if (currentElemDecl != null && currentElemDecl.fType instanceof 
XSComplexTypeDecl) {
-          XSComplexTypeDecl currentComplexType = (XSComplexTypeDecl) 
currentElemDecl.fType;
-          XSObjectListImpl attributeUses = (XSObjectListImpl) 
currentComplexType.getAttributeUses();           
-          
-          // iterate all the attributes, being passed to this method        
-          for (int attrIndx = 0; attrIndx < attributes.getLength(); 
attrIndx++) {
-             String attrName = attributes.getLocalName(attrIndx);
-             String attrUri = attributes.getURI(attrIndx);            
-             // iterate all the attribute declarations of a complex type, for 
the current element
-             for (int attrUsesIndx = 0; attrUsesIndx < 
attributeUses.getLength(); attrUsesIndx++) {
-                XSAttributeUseImpl attrUseImpl = (XSAttributeUseImpl) 
attributeUses.get(attrUsesIndx);
-                XSAttributeDeclaration attrDecl = 
attrUseImpl.getAttrDeclaration();              
-                // the current element, has an inheritable attribute
-                if (attrName.equals(attrDecl.getName()) && 
XSTypeHelper.isURIEqual(attrUri, attrDecl.getNamespace()) &&    
-                                                                               
        attrUseImpl.getInheritable()) {                   
-                    InheritableAttribute inhrAttr = new 
InheritableAttribute(attributes.getLocalName(attrIndx),
-                                                                             
attributes.getPrefix(attrIndx),
-                                                                             
attributes.getURI(attrIndx),
-                                                                             
attributes.getValue(attrIndx),
-                                                                             
attributes.getType(attrIndx)) ;
-                    fInheritableAttrList.add(inhrAttr);                   
-               }
-            }
-          }          
-       }
+        if (currentElemDecl != null && currentElemDecl.fType instanceof 
XSComplexTypeDecl) {
+            XSComplexTypeDecl currentComplexType = (XSComplexTypeDecl) 
currentElemDecl.fType;
+            XSObjectListImpl attributeUses = (XSObjectListImpl) 
currentComplexType.getAttributeUses();           
+
+            // iterate all the attributes, being passed to this method        
+            for (int attrIndx = 0; attrIndx < attributes.getLength(); 
attrIndx++) {
+                String attrName = attributes.getLocalName(attrIndx);
+                String attrUri = attributes.getURI(attrIndx);            
+                // iterate all the attribute declarations of a complex type, 
for the current element
+                for (int attrUsesIndx = 0; attrUsesIndx < 
attributeUses.getLength(); attrUsesIndx++) {
+                    XSAttributeUseImpl attrUseImpl = (XSAttributeUseImpl) 
attributeUses.get(attrUsesIndx);
+                    XSAttributeDeclaration attrDecl = 
attrUseImpl.getAttrDeclaration();              
+                    // the current element, has an inheritable attribute
+                    if (attrName.equals(attrDecl.getName()) && 
XSTypeHelper.isURIEqual(attrUri, attrDecl.getNamespace()) && 
attrUseImpl.getInheritable()) {                   
+                        InheritableAttribute inhrAttr = new 
InheritableAttribute(attributes.getLocalName(attrIndx),
+                                                                               
  attributes.getPrefix(attrIndx),
+                                                                               
  attributes.getURI(attrIndx),
+                                                                               
  attributes.getValue(attrIndx),
+                                                                               
  attributes.getType(attrIndx)) ;
+                        fInheritableAttrList.add(inhrAttr);                   
+                    }
+                }
+            }          
+        }
        
     } // saveInheritableAttributes
     
@@ -197,18 +195,18 @@ public class XSDTypeAlternativeValidator
      */
     private boolean attributeExists(XMLAttributes attributes, 
InheritableAttribute inhAttr) {
       
-      boolean attrExists = false;
-      
-      for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) {
-          String localName = attributes.getLocalName(attrIndx);
-          String uri = attributes.getURI(attrIndx);          
-          if (localName.equals(inhAttr.getLocalName()) && 
XSTypeHelper.isURIEqual(uri, inhAttr.getUri())) {              
-             attrExists = true;
-             break;
-          }
-      }
-      
-      return attrExists;
+        boolean attrExists = false;
+
+        for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) {
+            String localName = attributes.getLocalName(attrIndx);
+            String uri = attributes.getURI(attrIndx);          
+            if (localName.equals(inhAttr.getLocalName()) && 
XSTypeHelper.isURIEqual(uri, inhAttr.getUri())) {              
+                attrExists = true;
+                break;
+            }
+        }
+
+        return attrExists;
       
     } // attributeExists
     
@@ -219,40 +217,39 @@ public class XSDTypeAlternativeValidator
      */
     final class InheritableAttribute {       
        
-       private final String localName;
-       private final String prefix;
-       private final String uri;
-       private final String value;
-       private final String type;
-      
-       public InheritableAttribute(String localName, String prefix, String 
uri, 
-                                   String value, String type) {
-         this.localName = localName;
-         this.prefix = prefix;
-         this.uri = uri;
-         this.value = value;
-         this.type = type;
-       }
-       
-       public String getLocalName() {
-          return localName;
-       }
-       
-       public String getPrefix() {
-          return prefix;
-       }
-       
-       public String getUri() {
-          return uri;
-       }
-       
-       public String getValue() {
-          return value;
-       }
-       
-       public String getType() {
-          return type; 
-       }
+        private final String localName;
+        private final String prefix;
+        private final String uri;
+        private final String value;
+        private final String type;
+
+        public InheritableAttribute(String localName, String prefix, String 
uri, String value, String type) {
+            this.localName = localName;
+            this.prefix = prefix;
+            this.uri = uri;
+            this.value = value;
+            this.type = type;
+        }
+
+        public String getLocalName() {
+            return localName;
+        }
+
+        public String getPrefix() {
+            return prefix;
+        }
+
+        public String getUri() {
+            return uri;
+        }
+
+        public String getValue() {
+            return value;
+        }
+
+        public String getType() {
+            return type; 
+        }
        
     } // class InheritableAttribute
     

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=1072622&r1=1072621&r2=1072622&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
 Sun Feb 20 16:19:42 2011
@@ -58,8 +58,7 @@ public class Test extends AbstractPsycho
     protected final NamespaceSupport fXPath2NamespaceContext;
 
     /** Constructs a "test" for type alternatives */
-    public Test(XPath20 xpath, XSTypeAlternativeImpl typeAlternative,
-            NamespaceSupport namespaceContext) {
+    public Test(XPath20 xpath, XSTypeAlternativeImpl typeAlternative, 
NamespaceSupport namespaceContext) {
         fXPath = xpath;
         fXPathPsychoPath = null;
         fTypeAlternative = typeAlternative;
@@ -97,7 +96,7 @@ public class Test extends AbstractPsycho
     }
     
     /** Evaluate the test expression with respect to the specified element and 
its attributes */
-    public boolean evaluateTest(QName element, XMLAttributes attributes) {
+    public boolean evaluateTest(QName element, XMLAttributes attributes) {     
   
         if (fXPath != null) {
             return fXPath.evaluateTest(element, attributes);
         } else if (fXPathPsychoPath != null) {
@@ -105,7 +104,7 @@ public class Test extends AbstractPsycho
         }
         else {
             return false;
-        }
+        }        
     }
 
     public String toString() {
@@ -117,47 +116,45 @@ public class Test extends AbstractPsycho
      * and its attributes. Uses PsychoPath XPath 2.0 engine for the 
evaluation. 
      */
     private boolean evaluateTestExprWithPsychoPath(QName element, 
XMLAttributes attributes) {
-       boolean result = false;
-       
-       try {
-         // construct a DOM document (used by psychopath engine as XPath XDM 
instance). 
-         // A PSVI DOM is constructed to comply to PsychoPath design. This 
doesn't seem to 
-         // affect CTA psychopath evaluations. CTA spec doesn't require a 
typed XDM tree.
-         // REVISIT ...
-         Document document = new PSVIDocumentImpl();
-         
-         Element elem = document.createElementNS(element.uri, element.rawname);
-         for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) 
{         
-            PSVIAttrNSImpl attrNode = new 
PSVIAttrNSImpl((PSVIDocumentImpl)document,
-                                                          
attributes.getURI(attrIndx),
-                                                          
attributes.getQName(attrIndx));
-            attrNode.setNodeValue(attributes.getValue(attrIndx));
-            elem.setAttributeNode(attrNode);
-         }
-       
-         document.appendChild(elem);
-         
-         // construct parameter values for psychopath processor
-         Map psychoPathParams = new HashMap();
-         psychoPathParams.put("XPATH2_NS_CONTEXT", fXPath2NamespaceContext);
-         DynamicContext xpath2DynamicContext = initDynamicContext(null, 
document, psychoPathParams);
-         if (fTypeAlternative.fXPathDefaultNamespace != null) {
-             xpath2DynamicContext.add_namespace(null, 
fTypeAlternative.fXPathDefaultNamespace);  
-         }
-         result = evaluateXPathExpr(fXPathPsychoPath, elem);
-       } 
-       catch (StaticError ex) {
-           result = false; 
-       } 
-       catch(DynamicError ex) {
-           result = false;
-       }
-       catch(Exception ex) {
-           result = false;  
-       }
-       
-       return result;
+        
+        boolean evaluationResult = false;
+
+        try {
+            // construct a DOM document (used by psychopath engine as XPath 
XDM instance). 
+            // A PSVI DOM is constructed to comply to PsychoPath design. This 
doesn't seem to 
+            // affect CTA psychopath evaluations. CTA spec doesn't require a 
typed XDM tree.
+            // REVISIT ...
+            Document document = new PSVIDocumentImpl();
+            Element elem = document.createElementNS(element.uri, 
element.rawname);
+            for (int attrIndx = 0; attrIndx < attributes.getLength(); 
attrIndx++) {         
+                PSVIAttrNSImpl attrNode = new 
PSVIAttrNSImpl((PSVIDocumentImpl)document, attributes.getURI(attrIndx), 
attributes.getQName(attrIndx));
+                attrNode.setNodeValue(attributes.getValue(attrIndx));
+                elem.setAttributeNode(attrNode);
+            }
+
+            document.appendChild(elem);
+
+            // construct parameter values for psychopath xpath processor
+            Map psychoPathParams = new HashMap();
+            psychoPathParams.put("XPATH2_NS_CONTEXT", fXPath2NamespaceContext);
+            DynamicContext xpath2DynamicContext = initDynamicContext(null, 
document, psychoPathParams);
+            if (fTypeAlternative.fXPathDefaultNamespace != null) {
+                xpath2DynamicContext.add_namespace(null, 
fTypeAlternative.fXPathDefaultNamespace);  
+            }
+            evaluationResult = evaluateXPathExpr(fXPathPsychoPath, elem);
+        } 
+        catch (StaticError ex) {
+            evaluationResult = false; 
+        } 
+        catch(DynamicError ex) {
+            evaluationResult = false;
+        }
+        catch(Exception ex) {
+            evaluationResult = false;  
+        }
+
+        return evaluationResult;
        
-    } // evaluateTestWithPsychoPath
+    } // evaluateTestExprWithPsychoPath
     
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to