Author: mukulg
Date: Tue Jul  7 06:30:22 2009
New Revision: 791714

URL: http://svn.apache.org/viewvc?rev=791714&view=rev
Log:
cleaned up assertion code a bit

Modified:
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20Assert.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/xpath/XPath20Assert.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20Assert.java?rev=791714&r1=791713&r2=791714&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20Assert.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xpath/XPath20Assert.java
 Tue Jul  7 06:30:22 2009
@@ -21,7 +21,7 @@
 import org.apache.xerces.xni.NamespaceContext;
 
 /**
- * A class representing a XPath 2.0 expression for, assertions evaluation.
+ * A class representing an XPath 2.0 expression for, assertions evaluation.
  *
  * @author Mukul Gandhi, IBM
  * @version $Id$
@@ -32,7 +32,7 @@
     protected final NamespaceContext fContext;
     
     public XPath20Assert(String xpath, SymbolTable symbolTable,
-            NamespaceContext context) throws XPathException {
+                         NamespaceContext context) {
         fExpression = xpath;
         fContext = context;
     }

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=791714&r1=791713&r2=791714&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
 Tue Jul  7 06:30:22 2009
@@ -26,7 +26,6 @@
 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.xpath.XPathException;
 import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.SchemaSymbols;
 import org.apache.xerces.impl.xs.XSAnnotationImpl;
@@ -429,7 +428,7 @@
                     reportSchemaError("s4s-elt-must-match.1", new 
Object[]{"pattern", "(annotation?)", DOMUtil.getLocalName(child)}, child);
                 }
             }
-            // process 'assertion' facet. introduced in XML Schema 1.1
+            // process 'assertion' facet. introduced in XML Schema 1.1.
             else if (facet.equals(SchemaSymbols.ELT_ASSERTION)) {
                 attrs = fAttrChecker.checkAttributes(content, false, 
schemaDoc);
                 String test = (String) attrs[XSAttributeChecker.ATTIDX_XPATH];
@@ -472,18 +471,8 @@
                     }
                     
                     XSAssertImpl assertImpl = new XSAssertImpl(typeDef, 
annotations);
-                    Test testExpr = null;
-                    //set the test attribute value
-                    try {
-                        testExpr = new Test(new XPath20Assert(test, 
fSymbolTable, 
-                                       schemaDoc.fNamespaceSupport), 
assertImpl);
-                    }
-                    catch (XPathException e) {
-                        //if the xpath is invalid create a Test without an 
expression
-                        reportSchemaError(e.getKey(), new Object[] { test }, 
content);
-                        testExpr = new Test(null, assertImpl);
-                    }
-                    
+                    Test testExpr = new Test(new XPath20Assert(test, 
fSymbolTable, 
+                                           schemaDoc.fNamespaceSupport), 
assertImpl);                 
                     assertImpl.setTest(testExpr);
                     assertImpl.setXPathDefauleNamespace(defaultNamespace);
                     if (assertData == null) {

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=791714&r1=791713&r2=791714&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
 Tue Jul  7 06:30:22 2009
@@ -23,7 +23,6 @@
 import org.apache.xerces.impl.dv.XSSimpleType;
 import org.apache.xerces.impl.dv.xs.XSSimpleTypeDecl;
 import org.apache.xerces.impl.xpath.XPath20Assert;
-import org.apache.xerces.impl.xpath.XPathException;
 import org.apache.xerces.impl.xs.SchemaGrammar;
 import org.apache.xerces.impl.xs.SchemaSymbols;
 import org.apache.xerces.impl.xs.XSAnnotationImpl;
@@ -52,15 +51,15 @@
  *
  * <complexType
  *   abstract = boolean : false
- *   block = (#all | List of (extension | restriction))
- *   final = (#all | List of (extension | restriction))
+ *   block = (#all | List of (extension | restriction)) 
+ *   final = (#all | List of (extension | restriction)) 
  *   id = ID
- *   mixed = boolean : false
+ *   mixed = boolean
  *   name = NCName
+ *   defaultAttributesApply = boolean : true
  *   {any attributes with non-schema namespace . . .}>
- *   Content: (annotation?, (simpleContent | complexContent |
- *            ((group | all | choice | sequence)?,
- *            ((attribute | attributeGroup)*, anyAttribute?))))
+ *   Content: (annotation?, (simpleContent | complexContent | (openContent?, 
(group | all |
+ *   choice | sequence)?, ((attribute | attributeGroup)*, anyAttribute?), 
assert*)))
  * </complexType>
  * 
  * @xerces.internal  
@@ -1244,7 +1243,7 @@
     throws ComplexTypeRecoverableError {
         
         XSObjectList attrUseS = fromAttrGrp.getAttributeUses();
-        XSAttributeUseImpl  duplicateAttrUse =  null, oneAttrUse = null;
+        XSAttributeUseImpl  oneAttrUse = null;
         int attrCount = attrUseS.getLength();
         for (int i=0; i<attrCount; i++) {
             oneAttrUse = (XSAttributeUseImpl)attrUseS.item(i);
@@ -1541,15 +1540,8 @@
         return elementName.equals(SchemaSymbols.ELT_ASSERT);
     }
 
-    private void traverseSimpleContentDecl(Element simpleContentDecl) {
-    }
-    
-    private void traverseComplexContentDecl(Element complexContentDecl,
-            boolean mixedOnComplexTypeDecl) {
-    }
-
     /*
-     * traversal support, for XML Schema 1.1 'assertions'.
+     * traversal support for XML Schema 1.1, 'assertions'
      */
     private void traverseAsserts(Element assertElement,
             XSDocumentInfo schemaDoc, SchemaGrammar grammar,
@@ -1575,8 +1567,7 @@
                 childNode = DOMUtil.getNextSiblingElement(childNode);
 
                 if (childNode != null) {
-                    // it's an error to have something after the
-                    // annotation, in 'assert'
+                    // it's an error to have something after the annotation, 
in 'assert'
                     reportSchemaError("s4s-elt-invalid-content.1", new 
Object[] {
                             DOMUtil.getLocalName(assertElement),
                             DOMUtil.getLocalName(childNode) }, childNode);
@@ -1594,25 +1585,13 @@
                 annotations = new XSObjectListImpl();
                 ((XSObjectListImpl) annotations).addXSObject(annotation);
             } else {
-                // if no annotations are present add an empty list to
-                // the assertion
+                // if no annotations are present add an empty list to the 
assertion
                 annotations = XSObjectListImpl.EMPTY_LIST;
             }
 
             XSAssertImpl assertImpl = new XSAssertImpl(enclosingCT, 
annotations);
-            Test testExpr = null;
-            // set the test attribute value
-            try {
-                testExpr = new Test(new XPath20Assert(test, fSymbolTable,
-                        schemaDoc.fNamespaceSupport), assertImpl);
-            } catch (XPathException e) {
-                // if the xpath is invalid create a Test without an
-                // expression
-                reportSchemaError(e.getKey(), new Object[] { test },
-                        assertElement);
-                testExpr = new Test(null, assertImpl);
-            }
-
+            Test testExpr = new Test(new XPath20Assert(test, fSymbolTable,
+                                      schemaDoc.fNamespaceSupport), 
assertImpl);
             assertImpl.setTest(testExpr);
             assertImpl.setXPathDefauleNamespace(defaultNamespace);
 



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

Reply via email to