Author: mukulg
Date: Thu Oct 10 05:15:17 2019
New Revision: 1868214

URL: http://svn.apache.org/viewvc?rev=1868214&view=rev
Log:
modifying various minor whitespaces in source code. adding an api to 
org.apache.xerces.xni.NamespaceContext.

Modified:
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidatorBase.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDComplexTypeTraverser.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/DOMValidatorHelper.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/JAXPNamespaceContextWrapper.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/NamespaceSupport.java
    
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/NamespaceContext.java

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java?rev=1868214&r1=1868213&r2=1868214&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaLoader.java
 Thu Oct 10 05:15:17 2019
@@ -632,9 +632,8 @@ XSLoader, DOMConfiguration {
      * @throws IOException
      * @throws XNIException
      */
-    SchemaGrammar loadSchema(XSDDescription desc,
-            XMLInputSource source,
-            Hashtable locationPairs) throws IOException, XNIException {
+    SchemaGrammar loadSchema(XSDDescription desc, XMLInputSource source,
+                             Hashtable locationPairs) throws IOException, 
XNIException {
         
         // this should only be done once per invocation of this object;
         // unless application alters JAXPSource in the mean time.
@@ -644,7 +643,7 @@ XSLoader, DOMConfiguration {
         SchemaGrammar grammar = fSchemaHandler.parseSchema(source, desc, 
locationPairs);
         
         return grammar;
-    } // loadSchema(XSDDescription, XMLInputSource):  SchemaGrammar
+    } // loadSchema(XSDDescription, XMLInputSource, Hashtable):  SchemaGrammar
     
     /** 
      * This method tries to resolve location of the given schema.

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidatorBase.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidatorBase.java?rev=1868214&r1=1868213&r2=1868214&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidatorBase.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/XMLSchemaValidatorBase.java
 Thu Oct 10 05:15:17 2019
@@ -779,12 +779,9 @@ public class XMLSchemaValidatorBase impl
     //this is the function where logic of retrieving grammar is written , 
parser first tries to get the grammar from
     //the local pool, if not in local pool, it gives chance to application to 
be able to retrieve the grammar, then it
     //tries to parse the grammar using location hints from the give namespace.
-    SchemaGrammar findSchemaGrammar(
-        short contextType,
-        String namespace,
-        QName enclosingElement,
-        QName triggeringComponent,
-        XMLAttributes attributes) {
+    SchemaGrammar findSchemaGrammar(short contextType, String namespace,
+                                    QName enclosingElement, QName 
triggeringComponent,
+                                    XMLAttributes attributes) {
         SchemaGrammar grammar = null;
         //get the grammar from local pool...
         grammar = fGrammarBucket.getGrammar(namespace);
@@ -873,7 +870,7 @@ public class XMLSchemaValidatorBase impl
 
         return grammar;
 
-    } //findSchemaGrammar
+    } // findSchemaGrammar
     
     private boolean hasSchemaComponent(SchemaGrammar grammar, short 
contextType, QName triggeringComponent) {
         if (grammar != null && triggeringComponent != 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=1868214&r1=1868213&r2=1868214&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
 Thu Oct 10 05:15:17 2019
@@ -41,8 +41,8 @@ import org.apache.xerces.impl.xs.XSWildc
 import org.apache.xerces.impl.xs.assertion.Test;
 import org.apache.xerces.impl.xs.assertion.XSAssertImpl;
 import org.apache.xerces.impl.xs.util.XInt;
-import org.apache.xerces.impl.xs.util.XSObjectListImpl;
 import org.apache.xerces.impl.xs.util.XS11TypeHelper;
+import org.apache.xerces.impl.xs.util.XSObjectListImpl;
 import org.apache.xerces.util.DOMUtil;
 import org.apache.xerces.util.XMLChar;
 import org.apache.xerces.util.XMLSymbols;
@@ -79,7 +79,7 @@ import org.w3c.dom.Element;
  * @version $Id$
  */
 
-class  XSDComplexTypeTraverser extends XSDAbstractParticleTraverser {
+class XSDComplexTypeTraverser extends XSDAbstractParticleTraverser {
     
     // size of stack to hold globals:
     private final static int GLOBAL_NUM = 13;
@@ -799,8 +799,7 @@ class  XSDComplexTypeTraverser extends X
                             schemaDoc,grammar,fComplexTypeDecl);
                     if (node != null) {
                         if (isAssert(node)) {
-                            traverseAsserts(node, schemaDoc, grammar,
-                                    fComplexTypeDecl);
+                            traverseAsserts(node, schemaDoc, grammar, 
fComplexTypeDecl);
                         } else {
                             // either XML Schema 1.0 or a non assert element
                             
fAttrChecker.returnAttrArray(simpleContentAttrValues, schemaDoc);
@@ -812,8 +811,7 @@ class  XSDComplexTypeTraverser extends X
                         }
                     }
                 } else if (isAssert(attrOrAssertNode)) {
-                    traverseAsserts(attrOrAssertNode, schemaDoc, grammar,
-                            fComplexTypeDecl);
+                    traverseAsserts(attrOrAssertNode, schemaDoc, grammar, 
fComplexTypeDecl);
                 } else  {
                     fAttrChecker.returnAttrArray(simpleContentAttrValues, 
schemaDoc);
                     fAttrChecker.returnAttrArray(derivationTypeAttrValues, 
schemaDoc);
@@ -858,8 +856,7 @@ class  XSDComplexTypeTraverser extends X
 
                     if (node != null) {
                         if (isAssert(node)) {
-                            traverseAsserts(node, schemaDoc, grammar,
-                                            fComplexTypeDecl);
+                            traverseAsserts(node, schemaDoc, grammar, 
fComplexTypeDecl);
                         } else {
                             // a non assert element after attributes is an 
error
                             
fAttrChecker.returnAttrArray(simpleContentAttrValues, schemaDoc);
@@ -872,8 +869,7 @@ class  XSDComplexTypeTraverser extends X
                     }
                 }
                 else if (isAssert(attrOrAssertNode)) {
-                    traverseAsserts(attrOrAssertNode, schemaDoc, grammar,
-                            fComplexTypeDecl);
+                    traverseAsserts(attrOrAssertNode, schemaDoc, grammar, 
fComplexTypeDecl);
                 }
                 else {
                     fAttrChecker.returnAttrArray(simpleContentAttrValues, 
schemaDoc);
@@ -1647,8 +1643,7 @@ class  XSDComplexTypeTraverser extends X
 
                 if (node != null) {
                     if (isAssert(node)) {
-                        traverseAsserts(node, schemaDoc, grammar,
-                                fComplexTypeDecl);
+                        traverseAsserts(node, schemaDoc, grammar, 
fComplexTypeDecl);
                     } else {
                         // a non assert element after attributes is an error
                         throw new ComplexTypeRecoverableError(
@@ -1659,8 +1654,7 @@ class  XSDComplexTypeTraverser extends X
                 }
             }
             else if (isAssert(attrOrAssertNode)) {
-                traverseAsserts(attrOrAssertNode, schemaDoc, grammar,
-                        fComplexTypeDecl);
+                traverseAsserts(attrOrAssertNode, schemaDoc, grammar, 
fComplexTypeDecl);
             }
             else {
                 throw new 
ComplexTypeRecoverableError("s4s-elt-invalid-content.1",
@@ -1738,8 +1732,8 @@ class  XSDComplexTypeTraverser extends X
             Test testExpr = new Test(testStr, schemaDoc.fNamespaceSupport, 
assertImpl);
             String xpathDefaultNamespace = 
getXPathDefaultNamespaceForAssert(assertElement, schemaDoc, attrValues);
             assertImpl.setTest(testExpr, assertElement);
-            assertImpl.setXPathDefaultNamespace(xpathDefaultNamespace);
-            assertImpl.setXPath2NamespaceContext(new 
SchemaNamespaceSupport(schemaDoc.fNamespaceSupport));
+            assertImpl.setXPathDefaultNamespace(xpathDefaultNamespace);        
    
+            assertImpl.setXPath2NamespaceContext(new 
SchemaNamespaceSupport(schemaDoc.fNamespaceSupport));            
             String assertMessage = 
XMLChar.trim(assertElement.getAttributeNS(SchemaSymbols.URI_XERCES_EXTENSIONS, 
SchemaSymbols.ATT_ASSERT_MESSAGE));
             if (!"".equals(assertMessage)) {
                assertImpl.setMessage(assertMessage);

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=1868214&r1=1868213&r2=1868214&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
 Thu Oct 10 05:15:17 2019
@@ -324,7 +324,7 @@ public class XSDHandler {
     // Records which nodes are hidden when the input is a DOMInputSource.
     Hashtable fHiddenNodes = null;
 
-    // Conditional inclustion
+    // Conditional inclusion
     private static final String XSD_VERSION_1_0 = "1.0";
     private static final String XSD_VERSION_1_1 = "1.1";
 
@@ -569,9 +569,8 @@ public class XSDHandler {
      * @return the SchemaGrammar
      * @throws IOException
      */
-    public SchemaGrammar parseSchema(XMLInputSource is, XSDDescription desc,
-            Hashtable locationPairs)
-    throws IOException {
+    public SchemaGrammar parseSchema(XMLInputSource is, XSDDescription desc, 
+                                     Hashtable locationPairs) throws 
IOException {
         fLocationPairs = locationPairs;
         fSchemaParser.resetNodePool();   
         SchemaGrammar grammar = null;
@@ -1004,8 +1003,8 @@ public class XSDHandler {
         
         Element newSchemaRoot = null;
         for (Element child = DOMUtil.getFirstChildElement(rootNode);
-        child != null;
-        child = DOMUtil.getNextSiblingElement(child)) {
+                     child != null;
+                     child = DOMUtil.getNextSiblingElement(child)) {
             String schemaNamespace=null;
             String schemaHint=null;
             String localName = DOMUtil.getLocalName(child);

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/DOMValidatorHelper.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/DOMValidatorHelper.java?rev=1868214&r1=1868213&r2=1868214&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/DOMValidatorHelper.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/jaxp/validation/DOMValidatorHelper.java
 Thu Oct 10 05:15:17 2019
@@ -537,6 +537,10 @@ final class DOMValidatorHelper implement
         public boolean declarePrefix(String prefix, String uri) {
             return fNamespaceContext.declarePrefix(prefix, uri);
         }
+        
+        public boolean deletePrefix(String prefix) {
+            return fNamespaceContext.deletePrefix(prefix);
+        }
 
         public String getURI(String prefix) {
             String uri = fNamespaceContext.getURI(prefix);

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/JAXPNamespaceContextWrapper.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/JAXPNamespaceContextWrapper.java?rev=1868214&r1=1868213&r2=1868214&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/JAXPNamespaceContextWrapper.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/JAXPNamespaceContextWrapper.java
 Thu Oct 10 05:15:17 2019
@@ -127,6 +127,10 @@ public final class JAXPNamespaceContextW
     public boolean declarePrefix(String prefix, String uri) {
         return true;
     }
+    
+    public boolean deletePrefix(String prefix) {
+        return true;
+    }
 
     public int getDeclaredPrefixCount() {
         return (fPrefixes != null) ? fPrefixes.size() : 0;

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/NamespaceSupport.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/NamespaceSupport.java?rev=1868214&r1=1868213&r2=1868214&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/NamespaceSupport.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/util/NamespaceSupport.java
 Thu Oct 10 05:15:17 2019
@@ -181,6 +181,36 @@ public class NamespaceSupport implements
         return true;
 
     } // declarePrefix(String,String):boolean
+    
+    public boolean deletePrefix(String prefix) {
+        // ignore "xml" and "xmlns" prefixes
+        if (prefix == XMLSymbols.PREFIX_XML || prefix == 
XMLSymbols.PREFIX_XMLNS) {
+            return false;
+        }
+                
+        boolean prefixFound = false;
+        String[] nsCopy = new String[fNamespaceSize];
+        int nsCopyIdx = 0;
+        // search for prefix in current context
+        for (int i = 0; i < fNamespaceSize; i += 2) {
+            if (fNamespace[i] == prefix) {
+                prefixFound = true;
+            }
+            else {
+                nsCopy[nsCopyIdx++] = fNamespace[i];
+                nsCopy[nsCopyIdx++] = fNamespace[i + 1];
+            }
+        }
+        
+        if (prefixFound) {
+            fNamespaceSize -= 2;
+            fNamespace = nsCopy;
+            return true;
+        }
+        
+        return false;
+        
+    } // deletePrefix(String):boolean
 
        /**
         * @see org.apache.xerces.xni.NamespaceContext#getURI(String)

Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/NamespaceContext.java
URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/NamespaceContext.java?rev=1868214&r1=1868213&r2=1868214&view=diff
==============================================================================
--- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/NamespaceContext.java
 (original)
+++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/xni/NamespaceContext.java
 Thu Oct 10 05:15:17 2019
@@ -108,6 +108,17 @@ public interface NamespaceContext {
      */
     public boolean declarePrefix(String prefix, String uri);
     
+    /**
+     * Delete a namespace binding, corresponding to a namespace prefix.
+     * 
+     * @param prefix The prefix corresponding to which, namespace binding
+     *        is to be deleted.
+     *        
+     * @return true if namespace binding is successfully deleted, false
+     *         otherwise.       
+     */
+    public boolean deletePrefix(String prefix);
+    
 
     /**
      * Look up a prefix and get the currently-mapped Namespace URI.



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

Reply via email to