[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xerces-cvs
Subject:    svn commit: r955114 - in
From:       mrglavas () apache ! org
Date:       2010-06-16 2:28:41
Message-ID: 20100616022841.AF04423888D2 () eris ! apache ! org
[Download RAW message or body]

Author: mrglavas
Date: Wed Jun 16 02:28:41 2010
New Revision: 955114

URL: http://svn.apache.org/viewvc?rev=955114&view=rev
Log:
Synch up with SVN rev 955053. Sandy's fix for JIRA issue: \
https://issues.apache.org/jira/browse/XERCESJ-809. The fix is very similar to the \
patch Gareth submitted, to expand the location strings when they are stored in the \
hashtable.

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/XMLSchemaValidator.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=955114&r1=955113&r2=955114&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 \
Wed Jun 16 02:28:41 2010 @@ -50,6 +50,7 @@ import org.apache.xerces.util.MessageFor
 import org.apache.xerces.util.ParserConfigurationSettings;
 import org.apache.xerces.util.SymbolTable;
 import org.apache.xerces.util.XMLSymbols;
+import org.apache.xerces.util.URI.MalformedURIException;
 import org.apache.xerces.xni.XNIException;
 import org.apache.xerces.xni.grammars.Grammar;
 import org.apache.xerces.xni.grammars.XMLGrammarDescription;
@@ -684,7 +685,7 @@ XSLoader, DOMConfiguration {
                 XSAttributeDecl attrDecl = \
SchemaGrammar.SG_XSI.getGlobalAttributeDecl(SchemaSymbols.XSI_SCHEMALOCATION);  // \
validation the string value to get the list of URI's  attrDecl.fType.validate(sl, \
                null, null);
-                if (!tokenizeSchemaLocationStr(sl, locations)) {
+                if (!tokenizeSchemaLocationStr(sl, locations, null)) {
                     // report warning (odd number of items)
                     er.reportError(XSMessageFormatter.SCHEMA_DOMAIN,
                             "SchemaLocation",
@@ -727,7 +728,7 @@ XSLoader, DOMConfiguration {
     // @param schemaStr     The schemaLocation string to tokenize
     // @param locations     Hashtable mapping namespaces to LocationArray objects \
                holding lists of locaitons
     // @return true if no problems; false if string could not be tokenized
-    public static boolean tokenizeSchemaLocationStr(String schemaStr, Hashtable \
locations) { +    public static boolean tokenizeSchemaLocationStr(String schemaStr, \
Hashtable locations, String base) {  if (schemaStr!= null) {
             StringTokenizer t = new StringTokenizer(schemaStr, " \n\t\r");
             String namespace, location;
@@ -742,6 +743,12 @@ XSLoader, DOMConfiguration {
                     la = new LocationArray();
                     locations.put(namespace, la);
                 }
+                if (base != null) {
+                    try {
+                        location = XMLEntityManager.expandSystemId(location, base, \
false); +                    } catch (MalformedURIException e) {
+                    }
+                }
                 la.addLocation(location);
             }
         }

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/apac \
he/xerces/impl/xs/XMLSchemaValidator.java?rev=955114&r1=955113&r2=955114&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 \
Wed Jun 16 02:28:41 2010 @@ -2015,16 +2015,17 @@ public class XMLSchemaValidator
         }
 
         // get xsi:schemaLocation and xsi:noNamespaceSchemaLocation attributes,
-        // parse them to get the grammars
-
-        String sLocation =
-            attributes.getValue(SchemaSymbols.URI_XSI, \
                SchemaSymbols.XSI_SCHEMALOCATION);
-        String nsLocation =
-            attributes.getValue(SchemaSymbols.URI_XSI, \
                SchemaSymbols.XSI_NONAMESPACESCHEMALOCATION);
-        //store the location hints..  we need to do it so that we can defer the \
                loading of grammar until
-        //there is a reference to a component from that namespace. To provide \
                location hints to the
-        //application for a namespace
-        storeLocations(sLocation, nsLocation);
+        // parse them to get the grammars. But only do this if the grammar can grow.
+        if (!fUseGrammarPoolOnly) {
+            String sLocation =
+                attributes.getValue(SchemaSymbols.URI_XSI, \
SchemaSymbols.XSI_SCHEMALOCATION); +            String nsLocation =
+                attributes.getValue(SchemaSymbols.URI_XSI, \
SchemaSymbols.XSI_NONAMESPACESCHEMALOCATION); +            //store the location \
hints..  we need to do it so that we can defer the loading of grammar until +         \
//there is a reference to a component from that namespace. To provide location hints \
to the +            //application for a namespace
+            storeLocations(sLocation, nsLocation);
+        }
 
         // if we are in the content of "skip", then just skip this element
         // REVISIT:  is this the correct behaviour for ID constraints?  -NG
@@ -2899,7 +2900,7 @@ public class XMLSchemaValidator
 
     void storeLocations(String sLocation, String nsLocation) {
         if (sLocation != null) {
-            if (!XMLSchemaLoader.tokenizeSchemaLocationStr(sLocation, \
fLocationPairs)) { +            if \
(!XMLSchemaLoader.tokenizeSchemaLocationStr(sLocation, fLocationPairs, fLocator == \
null ? null : fLocator.getExpandedSystemId())) {  // error!
                 fXSIErrorReporter.reportError(
                     XSMessageFormatter.SCHEMA_DOMAIN,
@@ -2915,6 +2916,12 @@ public class XMLSchemaValidator
                 la = new XMLSchemaLoader.LocationArray();
                 fLocationPairs.put(XMLSymbols.EMPTY_STRING, la);
             }
+            if (fLocator != null) {
+                try {
+                    nsLocation = XMLEntityManager.expandSystemId(nsLocation, \
fLocator.getExpandedSystemId(), false); +                } catch \
(MalformedURIException e) { +                }
+            }
             la.addLocation(nsLocation);
         }
 
@@ -3053,13 +3060,8 @@ public class XMLSchemaValidator
         int counter = 0;
 
         for (int i=0; i<length; i++) {
-            try {
-                String id = XMLEntityManager.expandSystemId(locations[i], \
                desc.getBaseSystemId(), false);
-                if (!docLocations.contains(id)) {
-                    hints[counter++] = locations[i];
-                }
-            }
-            catch (MalformedURIException e) {
+            if (!docLocations.contains(locations[i])) {
+                hints[counter++] = locations[i];
             }
         }
 



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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic