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/24 23:41:06 UTC

svn commit: r1038854 - in /xerces/java/branches/xml-schema-1.1-dev: samples/xs/ src/org/apache/xerces/impl/xs/ src/org/apache/xerces/impl/xs/assertion/ src/org/apache/xerces/impl/xs/util/

Author: mukulg
Date: Wed Nov 24 22:41:05 2010
New Revision: 1038854

URL: http://svn.apache.org/viewvc?rev=1038854&view=rev
Log:
doing little refactoring (minor renaming of programming constructs and code-base indentation) as per commonly known conventions.

Modified:
    xerces/java/branches/xml-schema-1.1-dev/samples/xs/XSSerializer.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/assertion/XSAssertImpl.java
    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSTypeHelper.java

Modified: xerces/java/branches/xml-schema-1.1-dev/samples/xs/XSSerializer.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/samples/xs/XSSerializer.java?rev=1038854&r1=1038853&r2=1038854&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/samples/xs/XSSerializer.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/samples/xs/XSSerializer.java Wed Nov 24 22:41:05 2010
@@ -1114,38 +1114,29 @@ public class XSSerializer {
                                             Element parentDomNode)
                                             throws DOMException {
         
-        // iterate all attributes on the Complex type. all attributes on a 
-        // complex type (from all of xs:attribute & xs:attributeGroup 
-        // declarations) are expanded, into an XSObjectList list.  
+        // iterate all attributes on the complex type. all attributes on a complex type (from all-of 
+        // it's xs:attribute & xs:attributeGroup declarations) are expanded, into an XSObjectList list.  
         XSObjectList attributeUses = complexTypeDecl.getAttributeUses();
         for (int attrUsesIdx = 0; attrUsesIdx < attributeUses.getLength(); attrUsesIdx++) {
            XSAttributeUse attrUse = (XSAttributeUse) attributeUses.item(attrUsesIdx);
            String constraintName = null;
            String constraintVal = null;           
            if (attrUse.getConstraintType() != XSConstants.VC_NONE) {
-              constraintName = (attrUse.getConstraintType() == 
-                                         XSConstants.VC_DEFAULT) ? 
-                                         "default" : "fixed";
+              constraintName = (attrUse.getConstraintType() == XSConstants.VC_DEFAULT) ? "default" : "fixed";
               constraintVal = attrUse.getConstraintValue();
            }
            
-           String requiredVal = (attrUse.getRequired() == true) ? 
-                                 "required" : "optional"; 
+           String requiredVal = (attrUse.getRequired() == true) ? "required" : "optional"; 
            
            XSAttributeDecl attrDecl = (XSAttributeDecl) 
                                                   attrUse.getAttrDeclaration();
            XSComplexTypeDefinition enclosingCTDefn = attrDecl.
                                                   getEnclosingCTDefinition();
-           boolean complexTypesIdentical = (enclosingCTDefn == null) ? false : 
-                                                XSTypeHelper.schemaTypesIdentical(
-                                                                complexTypeDecl,
-                                                                enclosingCTDefn);
-           // do not add attributes, from the base type. they will be
-           // serialized as part of the base type serialization.
+           boolean complexTypesIdentical = (enclosingCTDefn == null) ? false : XSTypeHelper.isSchemaTypesIdentical(
+                                                                                  complexTypeDecl, enclosingCTDefn);
+           // do not add attributes, from the base type. they will be serialized as part of the base type serialization.
            if (complexTypesIdentical) {
-              addAttributeToSchemaComponent(document, parentDomNode, 
-                                            attrDecl, constraintName, 
-                                            constraintVal, requiredVal); 
+              addAttributeToSchemaComponent(document, parentDomNode, attrDecl, constraintName, constraintVal, requiredVal); 
            }
         }
         

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=1038854&r1=1038853&r2=1038854&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 Wed Nov 24 22:41:05 2010
@@ -176,7 +176,7 @@ public class XSDTypeAlternativeValidator
                 XSAttributeUseImpl attrUseImpl = (XSAttributeUseImpl) attributeUses.get(attrUsesIndx);
                 XSAttributeDeclaration attrDecl = attrUseImpl.getAttrDeclaration();              
                 // the current element, has an inheritable attribute
-                if (attrName.equals(attrDecl.getName()) && XSTypeHelper.uriEqual(attrUri, attrDecl.getNamespace()) &&    
+                if (attrName.equals(attrDecl.getName()) && XSTypeHelper.isUriEqual(attrUri, attrDecl.getNamespace()) &&    
                                                                                        attrUseImpl.getInheritable()) {                   
                     InheritableAttribute inhrAttr = new InheritableAttribute(attributes.getLocalName(attrIndx),
                                                                              attributes.getPrefix(attrIndx),
@@ -202,7 +202,7 @@ public class XSDTypeAlternativeValidator
       for (int attrIndx = 0; attrIndx < attributes.getLength(); attrIndx++) {
           String localName = attributes.getLocalName(attrIndx);
           String uri = attributes.getURI(attrIndx);          
-          if (localName.equals(inhAttr.getLocalName()) && XSTypeHelper.uriEqual(uri, inhAttr.getUri())) {              
+          if (localName.equals(inhAttr.getLocalName()) && XSTypeHelper.isUriEqual(uri, inhAttr.getUri())) {              
              attrExists = true;
              break;
           }

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=1038854&r1=1038853&r2=1038854&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 Wed Nov 24 22:41:05 2010
@@ -219,9 +219,8 @@ public class XSAssertImpl extends Abstra
     }
     
     /*
-     * Tests if two assertion components are equal. Xerces has a specific
-     * notion of assertions equality, as described by the algorithm in this
-     * method.
+     * Tests if two assertion components are equal. Xerces has a specific notion of assertions equality, 
+     * as described by the algorithm in this method.
      */
     public boolean equals(XSAssertImpl pAssertion) {
       boolean returnVal = false;
@@ -230,9 +229,8 @@ public class XSAssertImpl extends Abstra
       String currXpathStr = this.getTest().getXPath().toString();        
       
       // if type and the xpath string are same, the asserts are equal
-      if (XSTypeHelper.schemaTypesIdentical(pAssertion.getTypeDefinition(),
-                                            fTypeDefinition) && 
-                                            currXpathStr.equals(xpathStr)) {
+      if (XSTypeHelper.isSchemaTypesIdentical(pAssertion.getTypeDefinition(), fTypeDefinition) && 
+                                              currXpathStr.equals(xpathStr)) {
          returnVal = true;  
       }
         

Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSTypeHelper.java
URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSTypeHelper.java?rev=1038854&r1=1038853&r2=1038854&view=diff
==============================================================================
--- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSTypeHelper.java (original)
+++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/util/XSTypeHelper.java Wed Nov 24 22:41:05 2010
@@ -40,8 +40,7 @@ public class XSTypeHelper {
     /*
      * Checks if the two schema type components are identical.
      */
-    public static boolean schemaTypesIdentical(XSTypeDefinition typeDefn1,
-                                               XSTypeDefinition typeDefn2) {
+    public static boolean isSchemaTypesIdentical(XSTypeDefinition typeDefn1, XSTypeDefinition typeDefn2) {
         boolean typesIdentical = false;
         
         String type1Name = typeDefn1.getName();
@@ -55,11 +54,11 @@ public class XSTypeHelper {
         }
         
         if (!typesIdentical) {                        
-            if (uriEqual(typeDefn1.getNamespace(), typeDefn2.getNamespace())) {
-                // if targetNamespace of types are same, then check for  equality of type names and of the base type.
+            if (isUriEqual(typeDefn1.getNamespace(), typeDefn2.getNamespace())) {
+                // if targetNamespace of types are same, then check for  equality of type names and of the base type
                 if ((type1Name == null && type2Name == null) ||
                     (type1Name != null && type1Name.equals(type2Name))
-                          && (schemaTypesIdentical(typeDefn1.getBaseType(), typeDefn2.getBaseType()))) {
+                          && (isSchemaTypesIdentical(typeDefn1.getBaseType(), typeDefn2.getBaseType()))) {
                      typesIdentical = true;   
                 }
             }
@@ -67,13 +66,13 @@ public class XSTypeHelper {
         
         return typesIdentical;
         
-    } // schemaTypesIdentical
+    } // isSchemaTypesIdentical
     
     
     /*
      * Check if two URI values are equal.
      */
-    public static boolean uriEqual(String uri1, String uri2) {
+    public static boolean isUriEqual(String uri1, String uri2) {
         
         boolean uriEqual = false;
         
@@ -87,7 +86,7 @@ public class XSTypeHelper {
         
         return uriEqual;
         
-    } // uriEqual
+    } // isUriEqual
     
     
     /*
@@ -95,14 +94,14 @@ public class XSTypeHelper {
      * If this method returns 'true', then the value is valid with respect to entire union 
      * schema component. 
      */
-    public static boolean isAtomicValueValidForAnUnion(XSObjectList memberTypes,
-                                                       String content, ValidatedInfo validatedInfo) {
+    public static boolean isAtomicValueValidForAnUnion(XSObjectList memberTypes, String content, 
+                                                       ValidatedInfo validatedInfo) {
         
         boolean isValid = false;
         
-        // check the union member types in order to check for validity of an 'atomic value'.
-        // the validity of 'atomic value' wrt to the 1st available type in this sequence,
-        // is sufficient to achieve the objective of this method.
+        // check the union member types in order to check for validity of an 'atomic value'. the validity 
+        // of 'atomic value' wrt 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())) {                



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org