Author: borisk
Date: Mon Nov 23 11:35:28 2009
New Revision: 883307

URL: http://svn.apache.org/viewvc?rev=883307&view=rev
Log:
Mark schema DOM representation as unavailable after the call to TraverseSchema.

Modified:
    xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp
    xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
    xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp
    xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp
    xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp

Modified: xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp?rev=883307&r1=883306&r2=883307&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp Mon Nov 23 11:35:28 
2009
@@ -1955,6 +1955,17 @@
                         , grammarFound
                     );
 
+                    // Reset the now invalid schema roots in the collected
+                    // schema info entries.
+                    //
+                    {
+                      RefHash2KeysTableOfEnumerator<SchemaInfo> i (
+                        fToCacheGrammar ? fCachedSchemaInfoList : 
fSchemaInfoList);
+
+                      while (i.hasMoreElements ())
+                        i.nextElement().resetRoot ();
+                    }
+
                     if (fGrammarType == Grammar::DTDGrammarType) {
                         fGrammar = schemaGrammar;
                         fGrammarType = Grammar::SchemaGrammarType;
@@ -2177,6 +2188,17 @@
                 );
 
               grammar = schemaGrammar;
+
+              // Reset the now invalid schema roots in the collected
+              // schema info entries.
+              //
+              {
+                RefHash2KeysTableOfEnumerator<SchemaInfo> i (
+                  toCache ? fCachedSchemaInfoList : fSchemaInfoList);
+
+                while (i.hasMoreElements ())
+                  i.nextElement().resetRoot ();
+              }
             }
 
             if (fValidate) {

Modified: xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp?rev=883307&r1=883306&r2=883307&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp Mon Nov 23 11:35:28 
2009
@@ -3766,6 +3766,17 @@
                         , grammarFound
                     );
 
+                    // Reset the now invalid schema roots in the collected
+                    // schema info entries.
+                    //
+                    {
+                      RefHash2KeysTableOfEnumerator<SchemaInfo> i (
+                        fToCacheGrammar ? fCachedSchemaInfoList : 
fSchemaInfoList);
+
+                      while (i.hasMoreElements ())
+                        i.nextElement().resetRoot ();
+                    }
+
                     if (fGrammarType == Grammar::DTDGrammarType) {
                         fGrammar = schemaGrammar;
                         fGrammarType = Grammar::SchemaGrammarType;
@@ -3969,6 +3980,17 @@
                 );
 
               grammar = schemaGrammar;
+
+              // Reset the now invalid schema roots in the collected
+              // schema info entries.
+              //
+              {
+                RefHash2KeysTableOfEnumerator<SchemaInfo> i (
+                  toCache ? fCachedSchemaInfoList : fSchemaInfoList);
+
+                while (i.hasMoreElements ())
+                  i.nextElement().resetRoot ();
+              }
             }
 
             if (fValidate) {

Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp?rev=883307&r1=883306&r2=883307&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp Mon Nov 23 
11:35:28 2009
@@ -114,6 +114,9 @@
                                  const XMLCh* const name,
                                  SchemaInfo** enclosingSchema) {
 
+    if (fSchemaRootElement == 0)
+      return 0;
+
     SchemaInfo* currentInfo = this;
     DOMElement* child = getTopLevelComponent(compCategory, compName, name);
 
@@ -147,8 +150,8 @@
                                  const XMLCh* const compName,
                                  const XMLCh* const name) {
 
-    if (compCategory >= C_Count)
-        return 0;
+    if (fSchemaRootElement == 0 || compCategory >= C_Count)
+      return 0;
 
     DOMElement* child = XUtil::getFirstChildElement(fSchemaRootElement);
 

Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp?rev=883307&r1=883306&r2=883307&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp Mon Nov 23 
11:35:28 2009
@@ -113,6 +113,7 @@
     void setBlockDefault(const int aValue);
     void setFinalDefault(const int aValue);
     void setElemAttrDefaultQualified(const unsigned short aValue);
+    void resetRoot ();
 
     // -----------------------------------------------------------------------
     //  Access methods
@@ -273,6 +274,11 @@
     }*/
 }
 
+inline void SchemaInfo::resetRoot ()
+{
+    fSchemaRootElement = 0;
+}
+
 // ---------------------------------------------------------------------------
 //  SchemaInfo: Access methods
 // ---------------------------------------------------------------------------

Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp
URL: 
http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp?rev=883307&r1=883306&r2=883307&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Mon Nov 23 
11:35:28 2009
@@ -223,7 +223,7 @@
             if (multipleImport)
             {
               // If we are working on an existing schema, do some
-              // intitialization that is notherwise done by preprocessSchema.
+              // intitialization that is otherwise done by preprocessSchema.
               //
               fComplexTypeRegistry = fSchemaGrammar->getComplexTypeRegistry();
               fGroupRegistry = fSchemaGrammar->getGroupInfoRegistry();
@@ -5527,7 +5527,6 @@
     }
 
     if (!typeInfo) {
-
         if (!XMLString::equals(typeURI, SchemaSymbols::fgURI_SCHEMAFORSCHEMA) 
||
             XMLString::equals(fTargetNSURIString, 
SchemaSymbols::fgURI_SCHEMAFORSCHEMA)) {
 
@@ -5546,7 +5545,6 @@
 
     // restore schema information
     restoreSchemaInfo(saveInfo, infoType, saveScope);
-
     return typeInfo;
 }
 



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

Reply via email to