You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by bo...@apache.org on 2008/06/25 17:55:56 UTC

svn commit: r671592 [1/2] - in /xerces/c/trunk: doc/ src/xercesc/dom/ src/xercesc/internal/ src/xercesc/parsers/ src/xercesc/sax2/ src/xercesc/util/ src/xercesc/validators/schema/

Author: borisk
Date: Wed Jun 25 08:55:55 2008
New Revision: 671592

URL: http://svn.apache.org/viewvc?rev=671592&view=rev
Log:
Provide a way to disable automatic loading of schemas specified in XML documents. Patch by Wouter Coene.

Modified:
    xerces/c/trunk/doc/program-dom.xml
    xerces/c/trunk/doc/program-others.xml
    xerces/c/trunk/doc/program-sax.xml
    xerces/c/trunk/doc/program-sax2.xml
    xerces/c/trunk/src/xercesc/dom/DOMLSParser.hpp
    xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp
    xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
    xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp
    xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp
    xerces/c/trunk/src/xercesc/parsers/AbstractDOMParser.cpp
    xerces/c/trunk/src/xercesc/parsers/AbstractDOMParser.hpp
    xerces/c/trunk/src/xercesc/parsers/DOMLSParserImpl.cpp
    xerces/c/trunk/src/xercesc/parsers/SAX2XMLFilterImpl.hpp
    xerces/c/trunk/src/xercesc/parsers/SAX2XMLReaderImpl.cpp
    xerces/c/trunk/src/xercesc/parsers/SAX2XMLReaderImpl.hpp
    xerces/c/trunk/src/xercesc/parsers/SAXParser.cpp
    xerces/c/trunk/src/xercesc/parsers/SAXParser.hpp
    xerces/c/trunk/src/xercesc/sax2/SAX2XMLReader.hpp
    xerces/c/trunk/src/xercesc/util/XMLUni.cpp
    xerces/c/trunk/src/xercesc/util/XMLUni.hpp
    xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp

Modified: xerces/c/trunk/doc/program-dom.xml
URL: http://svn.apache.org/viewvc/xerces/c/trunk/doc/program-dom.xml?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/doc/program-dom.xml (original)
+++ xerces/c/trunk/doc/program-dom.xml Wed Jun 25 08:55:55 2008
@@ -478,6 +478,20 @@
 
             <p/>
 
+<anchor name="load-schema"/>
+            <table>
+                <tr><th colspan="2"><em>void setLoadSchema(const bool)</em></th></tr>
+                <tr><th><em>true:</em></th><td> Load the schema. </td></tr>
+                <tr><th><em>false:</em></th><td> Don't load the schema if it wasn't found in the grammar pool. </td></tr>
+                <tr><th><em>default:</em></th><td> true </td></tr>
+                <tr><th><em>note:</em></th><td> This feature is ignored and no schemas are loaded if schema processing is disabled. </td></tr>
+                <tr><th><em>see:</em></th><td>
+                <link anchor="schema">setDoSchema</link>
+                </td></tr>
+            </table>
+
+            <p/>
+
             <anchor name="load-external-dtd"/>
             <table>
                 <tr><th colspan="2"><em>void setLoadExternalDTD(const bool)</em></th></tr>
@@ -1236,6 +1250,23 @@
             </table>
 
             <p/>
+	    
+	    
+            <anchor name="builder-load-schema"/>
+            <table>
+                <tr><th colspan="2"><em>http://apache.org/xml/features/validating/load-schema</em></th></tr>
+                <tr><th><em>true:</em></th><td> Load the schema. </td></tr>
+                <tr><th><em>false:</em></th><td> Don't load the schema if it wasn't found in the grammar pool. </td></tr>
+                <tr><th><em>default:</em></th><td> true </td></tr>
+                <tr><th><em>XMLUni Predefined Constant:</em></th><td> fgXercesLoadSchema </td></tr>
+                <tr><th><em>note:</em></th><td> This feature is ignored and no schemas are loaded if schema processing is disabled. </td></tr>
+                <tr><th><em>see:</em></th><td>
+                <link anchor="builder-schema">schema</link>
+                </td></tr>
+            </table>
+
+            <p/>
+
 
             <anchor name="builder-load-external-dtd"/>
             <table>

Modified: xerces/c/trunk/doc/program-others.xml
URL: http://svn.apache.org/viewvc/xerces/c/trunk/doc/program-others.xml?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/doc/program-others.xml (original)
+++ xerces/c/trunk/doc/program-others.xml Wed Jun 25 08:55:55 2008
@@ -845,7 +845,7 @@
             The DGXMLScanner handles XML documents with DOCTYPE information. It does not do any
             XMLSchema processing, which means that any schema specific attributes (e.g. schemaLocation),
             will be treated as normal element attributes. Setting schema grammar specific features/properties
-            will have no effect on its behavior (e.g. setDoSchema(true) is ignored).
+            will have no effect on its behavior (e.g. setDoSchema(true) and setLoadSchema(true) are ignored).
             </p>
 
 <source>

Modified: xerces/c/trunk/doc/program-sax.xml
URL: http://svn.apache.org/viewvc/xerces/c/trunk/doc/program-sax.xml?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/doc/program-sax.xml (original)
+++ xerces/c/trunk/doc/program-sax.xml Wed Jun 25 08:55:55 2008
@@ -243,6 +243,20 @@
 
             <p/>
 
+            <anchor name="load-schema"/>
+            <table>
+                <tr><th colspan="2"><em>void setLoadSchema(const bool)</em></th></tr>
+                <tr><th><em>true:</em></th><td> Load the schema. </td></tr>
+                <tr><th><em>false:</em></th><td> Don't load the schema if it wasn't found in the grammar pool. </td></tr>
+                <tr><th><em>default:</em></th><td> true </td></tr>
+                <tr><th><em>note:</em></th><td> This feature is ignored and no schemas are loaded if schema processing is disabled. </td></tr>
+                <tr><th><em>see:</em></th><td>
+                <link anchor="schema">setDoSchema</link>
+                </td></tr>
+            </table>
+
+            <p/>
+
             <anchor name="load-external-dtd"/>
             <table>
                 <tr><th colspan="2"><em>void setLoadExternalDTD(const bool)</em></th></tr>

Modified: xerces/c/trunk/doc/program-sax2.xml
URL: http://svn.apache.org/viewvc/xerces/c/trunk/doc/program-sax2.xml?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/doc/program-sax2.xml (original)
+++ xerces/c/trunk/doc/program-sax2.xml Wed Jun 25 08:55:55 2008
@@ -284,6 +284,21 @@
 
             <p/>
 
+            <anchor name="load-schema"/>
+            <table>
+                <tr><th colspan="2"><em>http://apache.org/xml/features/validating/load-schema</em></th></tr>
+                <tr><th><em>true:</em></th><td> Load the schema. </td></tr>
+                <tr><th><em>false:</em></th><td> Don't load the schema if it wasn't found in the grammar pool. </td></tr>
+                <tr><th><em>default:</em></th><td> true </td></tr>
+                <tr><th><em>XMLUni Predefined Constant:</em></th><td> fgXercesLoadSchema </td></tr>
+                <tr><th><em>note:</em></th><td> This feature is ignored and no schemas are loaded if schema processing is disabled. </td></tr>
+                <tr><th><em>see:</em></th><td>
+                <link anchor="schema">http://apache.org/xml/features/validation/schema</link>
+                </td></tr>
+            </table>
+
+            <p/>
+
             <anchor name="load-external-dtd"/>
             <table>
                 <tr><th colspan="2"><em>http://apache.org/xml/features/nonvalidating/load-external-dtd</em></th></tr>

Modified: xerces/c/trunk/src/xercesc/dom/DOMLSParser.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/dom/DOMLSParser.hpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/dom/DOMLSParser.hpp (original)
+++ xerces/c/trunk/src/xercesc/dom/DOMLSParser.hpp Wed Jun 25 08:55:55 2008
@@ -265,6 +265,12 @@
       *     false (default)
       *         Don't perform full XMLSchema checking
       *
+      * "http://apache.org/xml/features/validating/load-schema"
+      *     true (default)
+      *         Allow the parser to load schemas that are not in the grammar pool
+      *     false
+      *         Schemas that are not in the grammar pool are ignored
+      *
       * "http://apache.org/xml/features/dom/user-adopts-DOMDocument"
       *     true 
       *         The DOMDocument objects returned by <code>parse</code> will be owned by the caller

Modified: xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/IGXMLScanner2.cpp Wed Jun 25 08:55:55 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -183,7 +183,7 @@
         //  boolean flag that lets us quickly below know which we are dealing
         //  with.
         const bool isNSAttr = (uriId == fXMLNSNamespaceId)
-                              
+
                               || XMLString::equals(suffPtr, XMLUni::fgXMLNSString)
                               || XMLString::equals(getURIText(uriId), SchemaSymbols::fgURI_XSI);
 
@@ -200,7 +200,7 @@
             if(fUndeclaredAttrRegistryNS->containsKey(suffPtr, uriId))
             {
                 emitError
-                ( 
+                (
                     XMLErrs::AttrAlreadyUsedInSTag
                     , namePtr
                     , elemDecl->getFullName()
@@ -257,7 +257,7 @@
                         ValueValidate = true;
                     }
                     else {
-                        otherXSI = true;                       
+                        otherXSI = true;
                     }
                 }
 
@@ -271,7 +271,7 @@
                         namePtr
                         , curPair->getValue()
                         , normBuf
-                    );                    
+                    );
 
                     if (fValidate && attrValidator && ValueValidate)
                     {
@@ -283,13 +283,13 @@
                             try
                             {
                                 if (tokenizeBuffer) {
-                                    XMLStringTokenizer tokenizer(normBuf.getRawBuffer(), fMemoryManager);                                    
-                                    while (tokenizer.hasMoreTokens()) {                                       
+                                    XMLStringTokenizer tokenizer(normBuf.getRawBuffer(), fMemoryManager);
+                                    while (tokenizer.hasMoreTokens()) {
                                         attrValidator->validate(
                                             tokenizer.nextToken(),
                                             theContext,
                                             fMemoryManager);
-                                    }                                  
+                                    }
                                 }
                                 else {
                                     attrValidator->validate(
@@ -307,7 +307,7 @@
 
                     if(getPSVIHandler())
                     {
-	                    psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId)); 
+	                    psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId));
 	                    XSSimpleTypeDefinition *validatingType = (attrValidator)
                             ? (XSSimpleTypeDefinition *)fModel->getXSObject(attrValidator)
                             : 0;
@@ -327,7 +327,7 @@
                 }
             }
         }
-        
+
         if (!isNSAttr || fGrammarType == Grammar::DTDGrammarType || otherXSI)
         {
             // Some checking for attribute wild card first (for schema)
@@ -390,7 +390,7 @@
                                     if (getPSVIHandler())
                                     {
                                         attrValid = PSVIItem::VALIDITY_INVALID;
-                                    }                                
+                                    }
                                 }
                             }
                         }
@@ -424,9 +424,9 @@
             //  how the derived validator and its elements store attributes.
             else
             {
-                if(fGrammarType == Grammar::DTDGrammarType) 
+                if(fGrammarType == Grammar::DTDGrammarType)
                     attDef = ((DTDElementDecl *)elemDecl)->getAttDef ( namePtr);
-            } 
+            }
 
             // now need to prepare for duplicate detection
             if(attDef)
@@ -443,7 +443,7 @@
                 else
                 {
                     emitError
-                    ( 
+                    (
                         XMLErrs::AttrAlreadyUsedInSTag
                         , attDef->getFullName()
                         , elemDecl->getFullName()
@@ -453,14 +453,14 @@
             }
             else
             {
-                if(fGrammarType == Grammar::DTDGrammarType) 
+                if(fGrammarType == Grammar::DTDGrammarType)
                 {
                     if(!fUndeclaredAttrRegistry->containsKey(namePtr))
                         fUndeclaredAttrRegistry->put((void *)namePtr, 0);
                     else
                     {
                         emitError
-                        ( 
+                        (
                             XMLErrs::AttrAlreadyUsedInSTag
                             , namePtr
                             , elemDecl->getFullName()
@@ -474,7 +474,7 @@
                     else
                     {
                         emitError
-                        ( 
+                        (
                             XMLErrs::AttrAlreadyUsedInSTag
                             , namePtr
                             , elemDecl->getFullName()
@@ -493,7 +493,7 @@
                     if(!laxThisOne && !skipThisOne)
                     {
                         fPSVIElemContext.fErrorOccurred = true;
-                    } 
+                    }
                     if(getPSVIHandler())
                     {
                         if(!laxThisOne && !skipThisOne)
@@ -641,7 +641,7 @@
             // now fill in the PSVIAttributes entry for this attribute:
             if(getPSVIHandler() && fGrammarType == Grammar::SchemaGrammarType)
 	        {
-	            psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId)); 
+	            psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId));
 	            SchemaAttDef *actualAttDef = 0;
 	            if(attDef)
 	                actualAttDef = (SchemaAttDef *)attDef;
@@ -708,10 +708,10 @@
         //  to the handler. We reuse its existing elements but expand it as
         //  required.
         XMLAttr* curAttr;
-        
+
         // check for duplicate namespace attributes:
-        // by checking for qualified names with the same local part and with prefixes 
-        // which have been bound to namespace names that are identical. 
+        // by checking for qualified names with the same local part and with prefixes
+        // which have been bound to namespace names that are identical.
         if (fGrammarType == Grammar::DTDGrammarType) {
             if (!toUseHashTable)
             {
@@ -720,7 +720,7 @@
                     if (uriId == curAttr->getURIId() &&
                         XMLString::equals(suffPtr, curAttr->getName())) {
                         emitError
-                        ( 
+                        (
 
                          XMLErrs::AttrAlreadyUsedInSTag
                         , curAttr->getName()
@@ -734,15 +734,15 @@
                 if (fAttrDupChkRegistry->containsKey((void*)suffPtr, uriId))
                 {
                     emitError
-                        ( 
+                        (
                         XMLErrs::AttrAlreadyUsedInSTag
                         , suffPtr
                         , elemDecl->getFullName()
                         );
                 }
-            }  
+            }
         }
-        
+
         if (retCount >= curAttListSize)
         {
             curAttr = new (fMemoryManager) XMLAttr
@@ -778,7 +778,7 @@
 
         if(psviAttr)
             psviAttr->setValue(curAttr->getValue());
-            
+
         // Bump the count of attrs in the list
         retCount++;
     }
@@ -821,7 +821,7 @@
                             XMLValid::RequiredAttrNotProvided
                             , curDef->getFullName()
                         );
-                        if(fGrammarType == Grammar::SchemaGrammarType) 
+                        if(fGrammarType == Grammar::SchemaGrammarType)
                         {
                             fPSVIElemContext.fErrorOccurred = true;
                         }
@@ -833,7 +833,7 @@
                         {
                             // XML 1.0 Section 2.9
                             // Document is standalone, so attributes must not be defaulted.
-                            fValidator->emitError(XMLValid::NoDefAttForStandalone, curDef->getFullName(), elemDecl->getFullName());                                                        
+                            fValidator->emitError(XMLValid::NoDefAttForStandalone, curDef->getFullName(), elemDecl->getFullName());
                             if(fGrammarType == Grammar::SchemaGrammarType)
                             {
                                 fPSVIElemContext.fErrorOccurred = true;
@@ -893,7 +893,7 @@
                         );
                         XSAttributeDeclaration *defAttrDecl = (XSAttributeDeclaration *)fModel->getXSObject((void *)curDef);
                         DatatypeValidator * attrDataType = ((SchemaAttDef *)curDef)->getDatatypeValidator();
-                        XSSimpleTypeDefinition *defAttrType = 
+                        XSSimpleTypeDefinition *defAttrType =
                             (XSSimpleTypeDefinition*)fModel->getXSObject(attrDataType);
                         // would have occurred during validation of default value
                         if(((SchemaValidator *)fValidator)->getErrorOccurred())
@@ -905,7 +905,7 @@
                                 , defAttrType
                                 , 0
                                 , curDef->getValue()
-                                , true 
+                                , true
                                 , defAttrDecl
                                 , 0
                             );
@@ -931,7 +931,7 @@
                                 , defAttrDecl
                                 , (defAttrMemberType)?((SchemaValidator *)fValidator)->getMostRecentAttrValidator():attrDataType
                             );
-                        } 
+                        }
                         defAttrToFill->setValue(curDef->getValue());
                     }
                 }
@@ -940,14 +940,14 @@
             {
                 //attribute is provided
                 // (schema) report error for PROHIBITED attrs that are present (V_TAGc)
-                if (defType == XMLAttDef::Prohibited && fValidate) 
+                if (defType == XMLAttDef::Prohibited && fValidate)
                 {
                     fValidator->emitError
                     (
                         XMLValid::ProhibitedAttributePresent
                         , curDef->getFullName()
                     );
-                    if(fGrammarType == Grammar::SchemaGrammarType) 
+                    if(fGrammarType == Grammar::SchemaGrammarType)
                     {
                         fPSVIElemContext.fErrorOccurred = true;
                         if (getPSVIHandler())
@@ -956,7 +956,7 @@
                             // bad luck...
                             PSVIAttribute *prohibitedAttr = fPSVIAttrList->getAttributePSVIByName
                             (
-                                attQName->getLocalPart(), 
+                                attQName->getLocalPart(),
                                 fURIStringPool->getValueForId(attQName->getURI())
                             );
                             prohibitedAttr->updateValidity(PSVIItem::VALIDITY_INVALID);
@@ -1017,12 +1017,12 @@
             //  escaped characters (which are indicated by a 0xFFFF value followed
             //  by the char that was escaped.)
             nextCh = *srcPtr;
-            
+
             // Do we have an escaped character ?
             if (nextCh == 0xFFFF)
             {
                 nextCh = *++srcPtr;
-            } 
+            }
             else if ( (nextCh <= 0x0D) && (nextCh == 0x09 || nextCh == 0x0A || nextCh == 0x0D) ) {
                 // Check Validity Constraint for Standalone document declaration
                 // XML 1.0, Section 2.9
@@ -1036,9 +1036,9 @@
             }
             else if (nextCh == chOpenAngle) {
                 //  If its not escaped, then make sure its not a < character, which is
-                //  not allowed in attribute values.                                
+                //  not allowed in attribute values.
                 emitError(XMLErrs::BracketInAttrValue, attName);
-                retVal = false;                
+                retVal = false;
             }
 
             // Add this char to the target buffer
@@ -1060,10 +1060,10 @@
             if (nextCh == 0xFFFF)
             {
                 nextCh = *++srcPtr;
-            } 
-            else if (nextCh == chOpenAngle) { 
+            }
+            else if (nextCh == chOpenAngle) {
                 //  If its not escaped, then make sure its not a < character, which is
-                //  not allowed in attribute values.                               
+                //  not allowed in attribute values.
                 emitError(XMLErrs::BracketInAttrValue, attName);
                 retVal = false;
             }
@@ -1113,7 +1113,7 @@
             srcPtr++;
         }
     }
- 
+
     return retVal;
 }
 
@@ -1371,13 +1371,13 @@
     fReaderMgr.pushReader(newReader, 0);
 
     // and reset security-related things if necessary:
-    if(fSecurityManager != 0) 
+    if(fSecurityManager != 0)
     {
         fEntityExpansionLimit = fSecurityManager->getEntityExpansionLimit();
         fEntityExpansionCount = 0;
     }
     fElemCount = 0;
-    if(fUIntPoolRowTotal >= 32) 
+    if(fUIntPoolRowTotal >= 32)
     { // 8 KB tied up with validating attributes...
         fAttDefRegistry->removeAll();
         recreateUIntPool();
@@ -1421,19 +1421,19 @@
 
         // Get the character data opts for the current element
         XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
-        if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType) 
+        if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType)
         {
             // And see if the current element is a 'Children' style content model
             ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
-            if(currType) 
+            if(currType)
             {
-                SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();                 
-                if(modelType == SchemaElementDecl::Children || 
-                   modelType == SchemaElementDecl::ElementOnlyEmpty) 
+                SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();
+                if(modelType == SchemaElementDecl::Children ||
+                   modelType == SchemaElementDecl::ElementOnlyEmpty)
                     charOpts = XMLElementDecl::SpacesOk;
-                else if(modelType == SchemaElementDecl::Empty) 
-                    charOpts = XMLElementDecl::NoCharData; 
-            } 
+                else if(modelType == SchemaElementDecl::Empty)
+                    charOpts = XMLElementDecl::NoCharData;
+            }
         } else // DTD grammar
             charOpts = topElem->fThisElement->getCharDataOpts();
 
@@ -1441,12 +1441,12 @@
         {
             // They definitely cannot handle any type of char data
             fValidator->emitError(XMLValid::NoCharDataInCM);
-            //if(fGrammarType == Grammar::SchemaGrammarType) 
+            //if(fGrammarType == Grammar::SchemaGrammarType)
             //{
               //  if (getPSVIHandler())
               //  {
-                    // REVISIT:                                   
-                    // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID);                    
+                    // REVISIT:
+                    // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID);
               //  }
            // }
         }
@@ -1554,12 +1554,12 @@
             else
             {
                 fValidator->emitError(XMLValid::NoCharDataInCM);
-                if(fGrammarType == Grammar::SchemaGrammarType) 
+                if(fGrammarType == Grammar::SchemaGrammarType)
                 {
                     if (getPSVIHandler())
                     {
-                        // REVISIT:                                   
-                        // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);                    
+                        // REVISIT:
+                        // PSVIAttribute->setValidity(PSVIItem::VALIDITY_INVALID);
                     }
                 }
             }
@@ -1768,14 +1768,17 @@
 void IGXMLScanner::resolveSchemaGrammar(const XMLCh* const loc, const XMLCh* const uri) {
 
     Grammar* grammar = 0;
- 
+
     {
-        XMLSchemaDescriptionImpl    theSchemaDescription(uri, fMemoryManager);   
-        theSchemaDescription.setLocationHints(loc); 
+        XMLSchemaDescriptionImpl    theSchemaDescription(uri, fMemoryManager);
+        theSchemaDescription.setLocationHints(loc);
         grammar = fGrammarResolver->getGrammar(&theSchemaDescription);
     }
 
-    if (!grammar || grammar->getGrammarType() == Grammar::DTDGrammarType) {
+    if (!grammar || grammar->getGrammarType() == Grammar::DTDGrammarType)
+    {
+      if (fLoadSchema)
+      {
         XSDDOMParser parser(0, fMemoryManager, 0);
 
         parser.setValidationScheme(XercesDOMParser::Val_Never);
@@ -1841,14 +1844,14 @@
                     );
                 }
                 else
-                    ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager);            
+                    ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager);
             }
             else
             {
                 if (fStandardUriConformant && urlTmp.hasInvalidChar())
                     ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager);
                 srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager);
-            }        
+            }
         }
 
         // Put a janitor on the input source
@@ -1934,9 +1937,10 @@
                 }
             }
         }
+      }
     }
-    else {
-
+    else
+    {
         //  Since we have seen a grammar, set our validation flag
         //  at this point if the validation scheme is auto
         if (fValScheme == Val_Auto && !fValidate) {
@@ -1962,6 +1966,7 @@
             fValidator->setGrammar(fGrammar);
         }
     }
+
     // fModel may need updating:
     if(getPSVIHandler())
         fModel = fGrammarResolver->getXSModel();
@@ -1970,7 +1975,7 @@
 InputSource* IGXMLScanner::resolveSystemId(const XMLCh* const sysId
                                           ,const XMLCh* const pubId)
 {
-    //Normalize sysId 
+    //Normalize sysId
     XMLBufBid nnSys(&fBufMgr);
     XMLBuffer& normalizedSysId = nnSys.getBuffer();
     XMLString::removeChar(sysId, 0xFFFF, normalizedSysId);
@@ -2028,14 +2033,14 @@
                 );
             }
             else
-                ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager);            
+                ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager);
         }
         else
         {
             if (fStandardUriConformant && urlTmp.hasInvalidChar())
                 ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager);
             srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager);
-        }        
+        }
     }
 
     return srcToFill;
@@ -2091,7 +2096,7 @@
         DOMElement* root = document->getDocumentElement();// This is what we pass to TraverserSchema
         if (root != 0)
         {
-            SchemaGrammar* grammar = new (fGrammarPoolMemoryManager) SchemaGrammar(fGrammarPoolMemoryManager);                   
+            SchemaGrammar* grammar = new (fGrammarPoolMemoryManager) SchemaGrammar(fGrammarPoolMemoryManager);
             XMLSchemaDescription* gramDesc = (XMLSchemaDescription*) grammar->getGrammarDescription();
             gramDesc->setContextType(XMLSchemaDescription::CONTEXT_PREPARSE);
             gramDesc->setLocationHints(src.getSystemId());
@@ -2524,19 +2529,19 @@
 
     // Get the character data opts for the current element
     XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
-    if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType) 
+    if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType)
     {
         // And see if the current element is a 'Children' style content model
         ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
-        if(currType) 
+        if(currType)
         {
-            SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();             
+            SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();
             if(modelType == SchemaElementDecl::Children ||
-               modelType == SchemaElementDecl::ElementOnlyEmpty) 
+               modelType == SchemaElementDecl::ElementOnlyEmpty)
                 charOpts = XMLElementDecl::SpacesOk;
-            else if(modelType == SchemaElementDecl::Empty) 
-                charOpts = XMLElementDecl::NoCharData; 
-        } 
+            else if(modelType == SchemaElementDecl::Empty)
+                charOpts = XMLElementDecl::NoCharData;
+        }
     } else // DTD grammar
         charOpts = topElem->fThisElement->getCharDataOpts();
 
@@ -2563,11 +2568,11 @@
                     // Error - standalone should have a value of "no" as whitespace detected in an
                     // element type with element content whose element declaration was external
                     fValidator->emitError(XMLValid::NoWSForStandalone);
-                    if(fGrammarType == Grammar::SchemaGrammarType) 
+                    if(fGrammarType == Grammar::SchemaGrammarType)
                     {
                         if (getPSVIHandler())
                         {
-                            // REVISIT:                                   
+                            // REVISIT:
                             // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID);
                         }
                     }
@@ -2610,7 +2615,7 @@
                         fValidator->emitError(XMLValid::NoCharDataInCM);
                         if (getPSVIHandler())
                         {
-                            // REVISIT:                                   
+                            // REVISIT:
                             // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID);
                         }
                     }
@@ -2894,19 +2899,19 @@
 
                 // Get the character data opts for the current element
                 XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
-                if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType) 
+                if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType)
                 {
                     // And see if the current element is a 'Children' style content model
                     ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
-                    if(currType) 
+                    if(currType)
                     {
-                        SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();                         
+                        SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();
                         if(modelType == SchemaElementDecl::Children ||
-                           modelType == SchemaElementDecl::ElementOnlyEmpty) 
+                           modelType == SchemaElementDecl::ElementOnlyEmpty)
                             charOpts = XMLElementDecl::SpacesOk;
-                        else if(modelType == SchemaElementDecl::Empty) 
-                            charOpts = XMLElementDecl::NoCharData; 
-                    } 
+                        else if(modelType == SchemaElementDecl::Empty)
+                            charOpts = XMLElementDecl::NoCharData;
+                    }
                 } else // DTD grammar
                     charOpts = topElem->fThisElement->getCharDataOpts();
 
@@ -2916,11 +2921,11 @@
                     // element type with element content whose element declaration was external
                     //
                     fValidator->emitError(XMLValid::NoWSForStandalone);
-                    if(fGrammarType == Grammar::SchemaGrammarType) 
+                    if(fGrammarType == Grammar::SchemaGrammarType)
                     {
                         if (getPSVIHandler())
                         {
-                            // REVISIT:                                   
+                            // REVISIT:
                             // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID);
                         }
                     }
@@ -2980,11 +2985,11 @@
     bool validName = fDoNamespaces ? fReaderMgr.getQName(bbName.getBuffer(), &colonPosition) :
                                      fReaderMgr.getName(bbName.getBuffer());
     if (!validName)
-    {        
+    {
         if (bbName.isEmpty())
             emitError(XMLErrs::ExpectedEntityRefName);
         else
-            emitError(XMLErrs::InvalidEntityRefName, bbName.getRawBuffer());  
+            emitError(XMLErrs::InvalidEntityRefName, bbName.getRawBuffer());
         return EntityExp_Failed;
     }
 
@@ -3077,7 +3082,7 @@
             XMLCh expLimStr[16];
             XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
             emitError
-            ( 
+            (
                 XMLErrs::EntityExpansionLimitExceeded
                 , expLimStr
             );
@@ -3135,7 +3140,7 @@
             XMLCh expLimStr[16];
             XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
             emitError
-            ( 
+            (
                 XMLErrs::EntityExpansionLimitExceeded
                 , expLimStr
             );

Modified: xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp Wed Jun 25 08:55:55 2008
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -87,7 +87,7 @@
     , fPSVIAttrList(0)
     , fModel(0)
     , fPSVIElement(0)
-    , fErrorStack(0)       
+    , fErrorStack(0)
 {
     CleanupType cleanup(this, &SGXMLScanner::cleanUp);
 
@@ -135,12 +135,12 @@
     , fPSVIAttrList(0)
     , fModel(0)
     , fPSVIElement(0)
-    , fErrorStack(0)        
+    , fErrorStack(0)
 {
     CleanupType cleanup(this, &SGXMLScanner::cleanUp);
 
     try
-    {	
+    {
         commonInit();
     }
     catch(const OutOfMemoryException&)
@@ -546,17 +546,17 @@
             //  the input.
             int colonPosition;
             if (!fReaderMgr.getQName(fAttNameBuf, &colonPosition))
-            {                
+            {
                 if (fAttNameBuf.isEmpty())
                     emitError(XMLErrs::ExpectedAttrName);
                 else
-                    emitError(XMLErrs::InvalidAttrName, fAttNameBuf.getRawBuffer());   
+                    emitError(XMLErrs::InvalidAttrName, fAttNameBuf.getRawBuffer());
                 fReaderMgr.skipPastChar(chCloseAngle);
                 return attCount;
             }
 
             const XMLCh* curAttNameBuf = fAttNameBuf.getRawBuffer();
- 
+
             // And next must be an equal sign
             if (!scanEq())
             {
@@ -865,7 +865,7 @@
             , elemName
         );
         fReaderMgr.skipPastChar(chCloseAngle);
-        fElemStack.popTop(); 
+        fElemStack.popTop();
         return;
     }
 
@@ -955,7 +955,7 @@
                     , topElem->fThisElement->getFormattedContentModel()
                 );
             }
-            
+
         }
 
         // update PSVI info
@@ -982,8 +982,8 @@
 
     }
 
-    // QName dv needed topElem to resolve URIs on the checkContent 
-    fElemStack.popTop(); 
+    // QName dv needed topElem to resolve URIs on the checkContent
+    fElemStack.popTop();
 
     // See if it was the root element, to avoid multiple calls below
     const bool isRoot = fElemStack.isEmpty();
@@ -995,7 +995,7 @@
             (SchemaElementDecl*)topElem->fThisElement, psviMemberType
         );
     }
-    // now we can reset the datatype buffer, since the 
+    // now we can reset the datatype buffer, since the
     // application has had a chance to copy the characters somewhere else
     ((SchemaValidator *)fValidator)->clearDatatypeBuffer();
 
@@ -1015,7 +1015,7 @@
         (
             *topElem->fThisElement
             , uriId
-            , isRoot            
+            , isRoot
             , fPrefixBuf.getRawBuffer()
         );
     }
@@ -1066,8 +1066,8 @@
 
 //  This method is called to scan a start tag when we are processing
 //  namespaces. This method is called after we've scanned the < of a
-//  start tag. So we have to get the element name, then scan the attributes, 
-//  after which we are either going to see >, />, or attributes followed 
+//  start tag. So we have to get the element name, then scan the attributes,
+//  after which we are either going to see >, />, or attributes followed
 //  by one of those sequences.
 bool SGXMLScanner::scanStartTag(bool& gotData)
 {
@@ -1173,7 +1173,7 @@
 
     //  Resolve the qualified name to a URI and name so that we can look up
     //  the element decl for this element. We have now update the prefix to
-    //  namespace map so we should get the correct element now.    
+    //  namespace map so we should get the correct element now.
     unsigned int uriId = resolveQNameWithColon
     (
         qnameRawBuf
@@ -1209,7 +1209,7 @@
           , qnameRawBuf
           , currentScope
         );
-        if(!elemDecl) 
+        if(!elemDecl)
         {
             // look in the list of undeclared elements, as would have been done
             // before we made grammars stateless:
@@ -1231,7 +1231,7 @@
                     XMLValid::GrammarNotFound
                     ,uriStr
                 );
-            } 
+            }
 
             elemDecl = fGrammar->getElemDecl
             (
@@ -1251,7 +1251,7 @@
                            , qnameRawBuf
                            , Grammar::TOP_LEVEL_SCOPE
                        );
-            if(!elemDecl) 
+            if(!elemDecl)
             {
                 // look in the list of undeclared elements, as would have been done
                 // before we made grammars stateless:
@@ -1266,7 +1266,7 @@
                                , nameRawBuf
                                , qnameRawBuf
                                , currentScope
-                           ); 
+                           );
                 bool errorCondition = elemDecl && elemDecl->getCreateReason() != XMLElementDecl::JustFaultIn;
                 if (errorCondition && fValidate) {
                     fValidator->emitError
@@ -1332,7 +1332,7 @@
                 (
                     XMLValid::GrammarNotFound
                   , XMLUni::fgZeroLenString
-                );                
+                );
             }
 
             elemDecl = fGrammar->getElemDecl
@@ -1446,9 +1446,9 @@
             }
             if (laxThisOne) {
                 fValidate = false;
-                fElemStack.setValidationFlag(fValidate);                
+                fElemStack.setValidationFlag(fValidate);
             }
-            
+
             if (fValidate)
                 {
                 fValidator->emitError
@@ -1584,7 +1584,7 @@
     }
 
     // activate identity constraints
-    if (toCheckIdentityConstraint()) 
+    if (toCheckIdentityConstraint())
     {
         fICHandler->activateIdentityConstraint
                         (
@@ -1681,7 +1681,7 @@
             if (((SchemaValidator*) fValidator)->getErrorOccurred())
                 fPSVIElemContext.fErrorOccurred = true;
             // note that if we're empty, won't be a current DV
-            else 
+            else
             {
                 if (fPSVIHandler)
                 {
@@ -1690,7 +1690,7 @@
                         fPSVIElemContext.fNormalizedValue = ((SchemaElementDecl *)elemDecl)->getDefaultValue();
                 }
                 if (fPSVIElemContext.fCurrentDV && fPSVIElemContext.fCurrentDV->getType() == DatatypeValidator::Union)
-                    psviMemberType = fValidationContext->getValidatingMemberType(); 
+                    psviMemberType = fValidationContext->getValidatingMemberType();
             }
 
             // call matchers and de-activate context
@@ -1700,7 +1700,7 @@
                        (
                         (SchemaElementDecl *) elemDecl
                       , fContent.getRawBuffer()
-                       );                
+                       );
             }
 
         }
@@ -1752,14 +1752,14 @@
             ComplexTypeInfo*   curTypeInfo = 0;
             DatatypeValidator* curDV = 0;
             XSTypeDefinition*  typeDef = 0;
-        
+
             if (fValidate && elemDecl->isDeclared())
             {
                 curTypeInfo = ((SchemaValidator*) fValidator)->getCurrentTypeInfo();
-                    
+
                 if (curTypeInfo)
                 {
-                    typeDef = (XSTypeDefinition*) fModel->getXSObject(curTypeInfo);       
+                    typeDef = (XSTypeDefinition*) fModel->getXSObject(curTypeInfo);
                 }
                 else
                 {
@@ -1771,21 +1771,21 @@
                     }
                 }
             }
-                       
+
             fPSVIElement->reset
                 (
-                  PSVIElement::VALIDITY_NOTKNOWN 
-                , PSVIElement::VALIDATION_NONE   
-                , fRootElemName                  
-                , ((SchemaValidator*) fValidator)->getIsElemSpecified() 
+                  PSVIElement::VALIDITY_NOTKNOWN
+                , PSVIElement::VALIDATION_NONE
+                , fRootElemName
+                , ((SchemaValidator*) fValidator)->getIsElemSpecified()
                 , (elemDecl->isDeclared()) ? (XSElementDeclaration*) fModel->getXSObject(elemDecl) : 0
-                , typeDef 
+                , typeDef
                 , 0 //memberType
-                , fModel 
-                , ((SchemaElementDecl*)elemDecl)->getDefaultValue()  
-                , 0                                                  
-                , 0                                                  
-                , 0                                                  
+                , fModel
+                , ((SchemaElementDecl*)elemDecl)->getDefaultValue()
+                , 0
+                , 0
+                , 0
                 );
 
 
@@ -1815,14 +1815,14 @@
     return resolveQNameWithColon(qName, prefixBuf, mode, prefixColonPos);
 }
 
-unsigned int 
+unsigned int
 SGXMLScanner::resolveQNameWithColon(const   XMLCh* const qName
                                     ,       XMLBuffer&   prefixBuf
                                     , const short        mode
                                     , const int          prefixColonPos)
 {
     //  Lets split out the qName into a URI and name buffer first. The URI
-    //  can be empty.    
+    //  can be empty.
     if (prefixColonPos == -1)
     {
         //  Its all name with no prefix, so put the whole thing into the name
@@ -1867,7 +1867,7 @@
 
             // check to see if uriId is empty
             if (fXMLVersion != XMLReader::XMLV1_0 &&
-                uriId == fElemStack.getEmptyNamespaceId())             
+                uriId == fElemStack.getEmptyNamespaceId())
                 emitError(XMLErrs::UnknownPrefix, prefixRawBuf);
 
             return uriId;
@@ -2120,7 +2120,7 @@
         }
     }
 
-    const bool hasDefs = (currType && fValidate) 
+    const bool hasDefs = (currType && fValidate)
             ? currType->hasAttDefs()
             : elemDecl->hasAttDefs();
 
@@ -2197,7 +2197,7 @@
         //  boolean flag that lets us quickly below know which we are dealing
         //  with.
         const bool isNSAttr = (uriId == fXMLNSNamespaceId)
-                              
+
                               || XMLString::equals(suffPtr, XMLUni::fgXMLNSString)
                               || XMLString::equals(getURIText(uriId), SchemaSymbols::fgURI_XSI);
 
@@ -2214,7 +2214,7 @@
             if(fUndeclaredAttrRegistryNS->containsKey(suffPtr, uriId))
             {
                 emitError
-                ( 
+                (
                     XMLErrs::AttrAlreadyUsedInSTag
                     , namePtr
                     , elemDecl->getFullName()
@@ -2251,7 +2251,7 @@
                         //do performance analysis of the anyuri datatype.
                         //ValueValidate = true;
                         ValueValidate = false;
-                        tokenizeBuffer = true;                        
+                        tokenizeBuffer = true;
                     }
                     else if (XMLString::equals(suffPtr, SchemaSymbols::fgXSI_NONAMESPACESCHEMALOCACTION))
                     {
@@ -2271,7 +2271,7 @@
                         ValueValidate = true;
                     }
                     else {
-                        otherXSI = true;                       
+                        otherXSI = true;
                     }
                 }
 
@@ -2285,7 +2285,7 @@
                         namePtr
                         , curPair->getValue()
                         , normBuf
-                    );                    
+                    );
 
                     if (fValidate && attrValidator && ValueValidate)
                     {
@@ -2297,13 +2297,13 @@
                             try
                             {
                                 if (tokenizeBuffer) {
-                                    XMLStringTokenizer tokenizer(normBuf.getRawBuffer(), fMemoryManager);                                    
-                                    while (tokenizer.hasMoreTokens()) {                                       
+                                    XMLStringTokenizer tokenizer(normBuf.getRawBuffer(), fMemoryManager);
+                                    while (tokenizer.hasMoreTokens()) {
                                         attrValidator->validate(
                                             tokenizer.nextToken(),
                                             theContext,
                                             fMemoryManager);
-                                    }                                  
+                                    }
                                 }
                                 else {
                                     attrValidator->validate(
@@ -2321,7 +2321,7 @@
 
                     if(getPSVIHandler() && fGrammarType == Grammar::SchemaGrammarType)
                     {
-	                    psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId)); 
+	                    psviAttr = fPSVIAttrList->getPSVIAttributeToFill(suffPtr, fURIStringPool->getValueForId(uriId));
 	                    XSSimpleTypeDefinition *validatingType = (attrValidator)
                             ? (XSSimpleTypeDefinition *)fModel->getXSObject(attrValidator)
                             : 0;
@@ -2342,7 +2342,7 @@
             }
         }
 
-        if (!isNSAttr || otherXSI)        
+        if (!isNSAttr || otherXSI)
         {
             // Some checking for attribute wild card first (for schema)
             bool laxThisOne = false;
@@ -2441,7 +2441,7 @@
                 else
                 {
                     emitError
-                    ( 
+                    (
                         XMLErrs::AttrAlreadyUsedInSTag
                         , attDef->getFullName()
                         , elemDecl->getFullName()
@@ -2456,7 +2456,7 @@
                 else
                 {
                     emitError
-                    ( 
+                    (
                         XMLErrs::AttrAlreadyUsedInSTag
                         , namePtr
                         , elemDecl->getFullName()
@@ -2472,7 +2472,7 @@
                 if(!laxThisOne && !skipThisOne)
                 {
                     fPSVIElemContext.fErrorOccurred = true;
-                } 
+                }
                 if(getPSVIHandler())
                 {
                     if(!laxThisOne && !skipThisOne)
@@ -2727,7 +2727,7 @@
         for(unsigned int i=0; i<attDefList.getAttDefCount(); i++)
         {
             // Get the current att def, for convenience and its def type
-            XMLAttDef *curDef = &attDefList.getAttDef(i);            
+            XMLAttDef *curDef = &attDefList.getAttDef(i);
             const XMLAttDef::DefAttTypes defType = curDef->getDefaultType();
 
             unsigned int *attCountPtr = fAttDefRegistry->get(curDef);
@@ -2805,7 +2805,7 @@
                         );
                         XSAttributeDeclaration *defAttrDecl = (XSAttributeDeclaration *)fModel->getXSObject((void *)curDef);
                         DatatypeValidator * attrDataType = ((SchemaAttDef *)curDef)->getDatatypeValidator();
-                        XSSimpleTypeDefinition *defAttrType = 
+                        XSSimpleTypeDefinition *defAttrType =
                             (XSSimpleTypeDefinition*)fModel->getXSObject(attrDataType);
                         // would have occurred during validation of default value
                         if(((SchemaValidator *)fValidator)->getErrorOccurred())
@@ -2817,7 +2817,7 @@
                                 , defAttrType
                                 , 0
                                 , curDef->getValue()
-                                , true 
+                                , true
                                 , defAttrDecl
                                 , 0
                             );
@@ -2853,7 +2853,7 @@
             {
                 //attribute is provided
                 // (schema) report error for PROHIBITED attrs that are present (V_TAGc)
-                if (defType == XMLAttDef::Prohibited && fValidate) 
+                if (defType == XMLAttDef::Prohibited && fValidate)
                 {
                     fValidator->emitError
                     (
@@ -2867,7 +2867,7 @@
                         // bad luck...
                         PSVIAttribute *prohibitedAttr = fPSVIAttrList->getAttributePSVIByName
                         (
-                            attQName->getLocalPart(), 
+                            attQName->getLocalPart(),
                             fURIStringPool->getValueForId(attQName->getURI())
                         );
                         prohibitedAttr->updateValidity(PSVIItem::VALIDITY_INVALID);
@@ -2917,7 +2917,7 @@
 
     //  Loop through the chars of the source value and normalize it according
     //  to the type.
-    States curState = InContent;    
+    States curState = InContent;
     bool firstNonWS = false;
     XMLCh nextCh;
     const XMLCh* srcPtr = value;
@@ -2928,12 +2928,12 @@
             //  escaped characters (which are indicated by a 0xFFFF value followed
             //  by the char that was escaped.)
             nextCh = *srcPtr;
-            
+
             // Do we have an escaped character ?
             if (nextCh == 0xFFFF)
             {
                 nextCh = *++srcPtr;
-            } 
+            }
             else if ( (nextCh <= 0x0D) && (nextCh == 0x09 || nextCh == 0x0A || nextCh == 0x0D) ) {
                 // Check Validity Constraint for Standalone document declaration
                 // XML 1.0, Section 2.9
@@ -2947,9 +2947,9 @@
             }
             else if (nextCh == chOpenAngle) {
                 //  If its not escaped, then make sure its not a < character, which is
-                //  not allowed in attribute values.                                
+                //  not allowed in attribute values.
                 emitError(XMLErrs::BracketInAttrValue, attName);
-                retVal = false;                
+                retVal = false;
             }
 
             // Add this char to the target buffer
@@ -2971,10 +2971,10 @@
             if (nextCh == 0xFFFF)
             {
                 nextCh = *++srcPtr;
-            } 
-            else if (nextCh == chOpenAngle) { 
+            }
+            else if (nextCh == chOpenAngle) {
                 //  If its not escaped, then make sure its not a < character, which is
-                //  not allowed in attribute values.                               
+                //  not allowed in attribute values.
                 emitError(XMLErrs::BracketInAttrValue, attName);
                 retVal = false;
             }
@@ -3263,13 +3263,13 @@
     fReaderMgr.pushReader(newReader, 0);
 
     // and reset security-related things if necessary:
-    if(fSecurityManager != 0) 
+    if(fSecurityManager != 0)
     {
         fEntityExpansionLimit = fSecurityManager->getEntityExpansionLimit();
         fEntityExpansionCount = 0;
     }
     fElemCount = 0;
-    if(fUIntPoolRowTotal >= 32) 
+    if(fUIntPoolRowTotal >= 32)
     { // 8 KB tied up with validating attributes...
         fAttDefRegistry->removeAll();
         recreateUIntPool();
@@ -3310,15 +3310,15 @@
         XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
         // And see if the current element is a 'Children' style content model
         ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
-        if(currType) 
+        if(currType)
         {
-            SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();             
+            SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();
             if(modelType == SchemaElementDecl::Children ||
-               modelType == SchemaElementDecl::ElementOnlyEmpty) 
+               modelType == SchemaElementDecl::ElementOnlyEmpty)
                 charOpts = XMLElementDecl::SpacesOk;
-            else if(modelType == SchemaElementDecl::Empty) 
-                charOpts = XMLElementDecl::NoCharData; 
-        } 
+            else if(modelType == SchemaElementDecl::Empty)
+                charOpts = XMLElementDecl::NoCharData;
+        }
 
         // should not be necessary once PSVI method on element decls
         // are removed
@@ -3328,7 +3328,7 @@
             fValidator->emitError(XMLValid::NoCharDataInCM);
             if (getPSVIHandler())
             {
-                // REVISIT:           
+                // REVISIT:
                 // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID);
             }
         }
@@ -3419,7 +3419,7 @@
                 fValidator->emitError(XMLValid::NoCharDataInCM);
                 if (getPSVIHandler())
                 {
-                    // REVISIT:                
+                    // REVISIT:
                     // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID);
                 }
             }
@@ -3482,7 +3482,7 @@
     //        2. if xxx is xml, then yyy must match XMLUni::fgXMLURIName, and vice versa
     //        3. yyy is not XMLUni::fgXMLNSURIName
     //        4. if xxx is not null, then yyy cannot be an empty string.
-    const XMLCh* prefPtr = XMLUni::fgZeroLenString;    
+    const XMLCh* prefPtr = XMLUni::fgZeroLenString;
     if (colonOfs != -1) {
         prefPtr = &attrName[colonOfs + 1];
 
@@ -3568,7 +3568,7 @@
             }
             else {
                 prefPtr = XMLUni::fgZeroLenString;
-            }            
+            }
 
             // if schema URI has been seen, scan for the schema location and uri
             // and resolve the schema grammar; or scan for schema type
@@ -3626,14 +3626,17 @@
 void SGXMLScanner::resolveSchemaGrammar(const XMLCh* const loc, const XMLCh* const uri) {
 
     Grammar* grammar = 0;
- 
+
     {
-        XMLSchemaDescriptionImpl    theSchemaDescription(uri, fMemoryManager);   
-        theSchemaDescription.setLocationHints(loc); 
+        XMLSchemaDescriptionImpl    theSchemaDescription(uri, fMemoryManager);
+        theSchemaDescription.setLocationHints(loc);
         grammar = fGrammarResolver->getGrammar(&theSchemaDescription);
     }
 
-    if (!grammar || grammar->getGrammarType() == Grammar::DTDGrammarType) {
+    if (!grammar || grammar->getGrammarType() == Grammar::DTDGrammarType)
+    {
+      if (fLoadSchema)
+      {
         XSDDOMParser parser(0, fMemoryManager, 0);
 
         parser.setValidationScheme(XercesDOMParser::Val_Never);
@@ -3641,7 +3644,7 @@
         parser.setUserEntityHandler(fEntityHandler);
         parser.setUserErrorReporter(fErrorReporter);
 
-        //Normalize sysId 
+        //Normalize sysId
         XMLBufBid nnSys(&fBufMgr);
         XMLBuffer& normalizedSysId = nnSys.getBuffer();
         XMLString::removeChar(loc, 0xFFFF, normalizedSysId);
@@ -3699,7 +3702,7 @@
                     );
                 }
                 else
-                    ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager);            
+                    ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager);
             }
             else
             {
@@ -3707,7 +3710,7 @@
                     ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager);
 
                 srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager);
-            }        
+            }
         }
 
         // Put a janitor on the input source
@@ -3781,9 +3784,10 @@
                 }
             }
         }
+      }
     }
-    else {
-
+    else
+    {
         //  Since we have seen a grammar, set our validation flag
         //  at this point if the validation scheme is auto
         if (fValScheme == Val_Auto && !fValidate) {
@@ -3807,7 +3811,7 @@
 InputSource* SGXMLScanner::resolveSystemId(const XMLCh* const sysId
                                           ,const XMLCh* const pubId)
 {
-    //Normalize sysId 
+    //Normalize sysId
     XMLBufBid nnSys(&fBufMgr);
     XMLBuffer& normalizedSysId = nnSys.getBuffer();
     XMLString::removeChar(sysId, 0xFFFF, normalizedSysId);
@@ -3865,14 +3869,14 @@
                 );
             }
             else
-                ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager);            
+                ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager);
         }
         else
         {
             if (fStandardUriConformant && urlTmp.hasInvalidChar())
                 ThrowXMLwithMemMgr(MalformedURLException, XMLExcepts::URL_MalformedURL, fMemoryManager);
             srcToFill = new (fMemoryManager) URLInputSource(urlTmp, fMemoryManager);
-        }              
+        }
     }
 
     return srcToFill;
@@ -4139,15 +4143,15 @@
     XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
     // And see if the current element is a 'Children' style content model
     ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
-    if(currType) 
+    if(currType)
     {
-        SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();         
+        SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();
         if(modelType == SchemaElementDecl::Children ||
-           modelType == SchemaElementDecl::ElementOnlyEmpty) 
+           modelType == SchemaElementDecl::ElementOnlyEmpty)
             charOpts = XMLElementDecl::SpacesOk;
-        else if(modelType == SchemaElementDecl::Empty) 
-            charOpts = XMLElementDecl::NoCharData; 
-    } 
+        else if(modelType == SchemaElementDecl::Empty)
+            charOpts = XMLElementDecl::NoCharData;
+    }
 
     // should not be necessary when PSVI on element decl removed
     const ElemStack::StackElem* topElem = fElemStack.topElement();
@@ -4177,7 +4181,7 @@
                     fValidator->emitError(XMLValid::NoWSForStandalone);
                     if (getPSVIHandler())
                     {
-                        // REVISIT:                
+                        // REVISIT:
                         // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID);
                     }
                 }
@@ -4215,7 +4219,7 @@
                     fValidator->emitError(XMLValid::NoCharDataInCM);
                     if (getPSVIHandler())
                     {
-                        // REVISIT:                
+                        // REVISIT:
                         // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID);
                     }
                 }
@@ -4490,13 +4494,13 @@
                 XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
                 // And see if the current element is a 'Children' style content model
                 ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
-                if(currType) 
+                if(currType)
                 {
-                    SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();                     
+                    SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();
                     if(modelType == SchemaElementDecl::Children ||
-                       modelType == SchemaElementDecl::ElementOnlyEmpty) 
+                       modelType == SchemaElementDecl::ElementOnlyEmpty)
                         charOpts = XMLElementDecl::SpacesOk;
-                } 
+                }
 
                 if (charOpts == XMLElementDecl::SpacesOk)  // => Element Content
                 {
@@ -4506,7 +4510,7 @@
                     fValidator->emitError(XMLValid::NoWSForStandalone);
                     if (getPSVIHandler())
                     {
-                        // REVISIT:                
+                        // REVISIT:
                         // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID);
                     }
                 }
@@ -4563,7 +4567,7 @@
     XMLBufBid bbName(&fBufMgr);
     int colonPosition;
     if (!fReaderMgr.getQName(bbName.getBuffer(), &colonPosition))
-    {        
+    {
         if (bbName.isEmpty())
             emitError(XMLErrs::ExpectedEntityRefName);
         else
@@ -4601,7 +4605,7 @@
         XMLCh expLimStr[16];
         XMLString::binToText(fEntityExpansionLimit, expLimStr, 15, 10, fMemoryManager);
         emitError
-        ( 
+        (
             XMLErrs::EntityExpansionLimitExceeded
             , expLimStr
         );
@@ -4767,7 +4771,7 @@
             if (getPSVIHandler())
             {
                 // REVISIT:
-                // PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_NONE);            
+                // PSVIAttribute->setValidationAttempted(PSVIItem::VALIDATION_NONE);
             }
         }
         else if (defType == XMLAttDef::ProcessContents_Lax) {
@@ -4837,7 +4841,7 @@
         , validationAttempted
         , fRootElemName
         , fPSVIElemContext.fIsSpecified
-        , (elemDecl->isDeclared()) 
+        , (elemDecl->isDeclared())
             ? (XSElementDeclaration*) fModel->getXSObject(elemDecl) : 0
         , typeDef
         , (memberDV) ? (XSSimpleTypeDefinition*) fModel->getXSObject(memberDV) : 0

Modified: xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLScanner.cpp Wed Jun 25 08:55:55 2008
@@ -100,6 +100,7 @@
     , fToCacheGrammar(false)
     , fUseCachedGrammar(false)
     , fLoadExternalDTD(true)
+    , fLoadSchema(true)
     , fNormalizeData(true)
     , fGenerateSyntheticAnnotations(false)
     , fValidateAnnotations(false)
@@ -199,6 +200,7 @@
     , fToCacheGrammar(false)
     , fUseCachedGrammar(false)
 	, fLoadExternalDTD(true)
+    , fLoadSchema(true)
     , fNormalizeData(true)
     , fGenerateSyntheticAnnotations(false)
     , fValidateAnnotations(false)
@@ -657,6 +659,7 @@
     cacheGrammarFromParse(refScanner->isCachingGrammarFromParse());
     useCachedGrammarInParse(refScanner->isUsingCachedGrammarInParse());
     setLoadExternalDTD(refScanner->getLoadExternalDTD());
+    setLoadSchema(refScanner->getLoadSchema());
     setNormalizeData(refScanner->getNormalizeData());
     setExternalSchemaLocation(refScanner->getExternalSchemaLocation());
     setExternalNoNamespaceSchemaLocation(refScanner->getExternalNoNamespaceSchemaLocation());

Modified: xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp (original)
+++ xerces/c/trunk/src/xercesc/internal/XMLScanner.hpp Wed Jun 25 08:55:55 2008
@@ -267,6 +267,7 @@
     XMLCh* getExternalNoNamespaceSchemaLocation() const;
     SecurityManager* getSecurityManager() const;
     bool getLoadExternalDTD() const;
+    bool getLoadSchema() const;
     bool getNormalizeData() const;
     bool isCachingGrammarFromParse() const;
     bool isUsingCachedGrammarInParse() const;
@@ -374,6 +375,7 @@
     void setExternalNoNamespaceSchemaLocation(const char* const noNamespaceSchemaLocation);
     void setSecurityManager(SecurityManager* const securityManager);
     void setLoadExternalDTD(const bool loadDTD);
+    void setLoadSchema(const bool loadSchema);
     void setNormalizeData(const bool normalizeData);
     void setCalculateSrcOfs(const bool newValue);
     void setParseSettings(XMLScanner* const refScanner);
@@ -694,6 +696,10 @@
     //  fLoadExternalDTD
     //      This flag indicates whether the external DTD be loaded or not
     //
+    //  fLoadSchema
+    //      This flag indicates whether the parser should attempt to load
+    //      schemas if they cannot be found in the grammar pool.
+    //
     //  fNormalizeData
     //      This flag indicates whether the parser should perform datatype
     //      normalization that is defined in the schema.
@@ -738,6 +744,7 @@
     bool                        fToCacheGrammar;
     bool                        fUseCachedGrammar;
     bool                        fLoadExternalDTD;
+    bool                        fLoadSchema;
     bool                        fNormalizeData;
     bool                        fGenerateSyntheticAnnotations;
     bool                        fValidateAnnotations;
@@ -1039,6 +1046,11 @@
     return fLoadExternalDTD;
 }
 
+inline bool XMLScanner::getLoadSchema() const
+{
+    return fLoadSchema;
+}
+
 inline bool XMLScanner::getNormalizeData() const
 {
     return fNormalizeData;
@@ -1256,6 +1268,11 @@
     fLoadExternalDTD = loadDTD;
 }
 
+inline void XMLScanner::setLoadSchema(const bool loadSchema)
+{
+    fLoadSchema = loadSchema;
+}
+
 inline void XMLScanner::setNormalizeData(const bool normalizeData)
 {
     fNormalizeData = normalizeData;

Modified: xerces/c/trunk/src/xercesc/parsers/AbstractDOMParser.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/parsers/AbstractDOMParser.cpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/parsers/AbstractDOMParser.cpp (original)
+++ xerces/c/trunk/src/xercesc/parsers/AbstractDOMParser.cpp Wed Jun 25 08:55:55 2008
@@ -320,6 +320,11 @@
     return fScanner->getLoadExternalDTD();
 }
 
+bool AbstractDOMParser::getLoadSchema() const
+{
+    return fScanner->getLoadSchema();
+}
+
 bool AbstractDOMParser::getCalculateSrcOfs() const
 {
     return fScanner->getCalculateSrcOfs();
@@ -448,6 +453,11 @@
     fScanner->setLoadExternalDTD(newState);
 }
 
+void AbstractDOMParser::setLoadSchema(const bool newState)
+{
+    fScanner->setLoadSchema(newState);
+}
+
 void AbstractDOMParser::setCalculateSrcOfs(const bool newState)
 {
     fScanner->setCalculateSrcOfs(newState);

Modified: xerces/c/trunk/src/xercesc/parsers/AbstractDOMParser.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/parsers/AbstractDOMParser.hpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/parsers/AbstractDOMParser.hpp (original)
+++ xerces/c/trunk/src/xercesc/parsers/AbstractDOMParser.hpp Wed Jun 25 08:55:55 2008
@@ -348,6 +348,19 @@
       */
     bool getLoadExternalDTD() const;
 
+    /** Get the 'Loading Schema' flag
+      *
+      * This method returns the state of the parser's loading schema
+      * flag.
+      *
+      * @return true, if the parser is currently configured to
+      *         automatically load schemas that are not in the
+      *         grammar pool, false otherwise.
+      *
+      * @see #setLoadSchema
+      */
+    bool getLoadSchema() const;
+
     /** Get the 'create comment node' flag
       *
       * This method returns the flag that specifies whether the parser is
@@ -768,6 +781,23 @@
       */
     void setLoadExternalDTD(const bool newState);
 
+    /** Set the 'Loading Schema' flag
+      *
+      * This method allows users to enable or disable the loading of schemas.
+      * When set to false, the parser not attempt to load schemas beyond
+      * querying the grammar pool for them.
+      *
+      * The parser's default state is: true.
+      *
+      * @param newState The value specifying whether schemas should
+      *                 be loaded if they're not found in the grammar
+      *                 pool.
+      *
+      * @see #getLoadSchema
+      * @see #setDoSchema
+      */
+    void setLoadSchema(const bool newState);
+
      /** Set the 'create comment nodes' flag
       *
       * This method allows the user to specify whether the parser should

Modified: xerces/c/trunk/src/xercesc/parsers/DOMLSParserImpl.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/parsers/DOMLSParserImpl.cpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/parsers/DOMLSParserImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/parsers/DOMLSParserImpl.cpp Wed Jun 25 08:55:55 2008
@@ -121,6 +121,7 @@
     fSupportedParameters->add(XMLUni::fgXercesSchemaFullChecking);
     fSupportedParameters->add(XMLUni::fgXercesUserAdoptsDOMDocument);
     fSupportedParameters->add(XMLUni::fgXercesLoadExternalDTD);
+    fSupportedParameters->add(XMLUni::fgXercesLoadSchema);
     fSupportedParameters->add(XMLUni::fgXercesContinueAfterFatalError);
     fSupportedParameters->add(XMLUni::fgXercesValidationErrorAsFatal);
     fSupportedParameters->add(XMLUni::fgXercesCacheGrammarFromParse);
@@ -344,6 +345,10 @@
     {
         setLoadExternalDTD(state);
     }
+    else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadSchema) == 0)
+    {
+        setLoadSchema(state);
+    }
     else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesContinueAfterFatalError) == 0)
     {
         setExitOnFirstFatalError(!state);
@@ -531,6 +536,10 @@
     {
         return (void*)getLoadExternalDTD();
     }
+    else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadSchema) == 0)
+    {
+        return (void*)getLoadSchema();
+    }
     else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesContinueAfterFatalError) == 0)
     {
         return (void*)!getExitOnFirstFatalError();
@@ -647,6 +656,7 @@
         XMLString::compareIStringASCII(name, XMLUni::fgXercesSchemaFullChecking) == 0 ||
         XMLString::compareIStringASCII(name, XMLUni::fgXercesIdentityConstraintChecking) == 0 ||
         XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadExternalDTD) == 0 ||
+        XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadSchema) == 0 ||
         XMLString::compareIStringASCII(name, XMLUni::fgXercesContinueAfterFatalError) == 0 ||
         XMLString::compareIStringASCII(name, XMLUni::fgXercesValidationErrorAsFatal) == 0 ||
         XMLString::compareIStringASCII(name, XMLUni::fgXercesCacheGrammarFromParse) == 0 ||

Modified: xerces/c/trunk/src/xercesc/parsers/SAX2XMLFilterImpl.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/parsers/SAX2XMLFilterImpl.hpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/parsers/SAX2XMLFilterImpl.hpp (original)
+++ xerces/c/trunk/src/xercesc/parsers/SAX2XMLFilterImpl.hpp Wed Jun 25 08:55:55 2008
@@ -208,7 +208,8 @@
     * <br>http://apache.org/xml/features/validation/reuse-grammar (default: false)
     * <br>http://apache.org/xml/features/validation/schema (default: true)
     * <br>http://apache.org/xml/features/validation/schema-full-checking (default: false)
-    * <br>http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true)
+    * <br>http://apache.org/xml/features/validating/load-schema (default: true)
+    * <br>http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true)    
     * <br>http://apache.org/xml/features/continue-after-fatal-error (default: false)
     * <br>http://apache.org/xml/features/validation-error-as-fatal (default: false)    
     *

Modified: xerces/c/trunk/src/xercesc/parsers/SAX2XMLReaderImpl.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/parsers/SAX2XMLReaderImpl.cpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/parsers/SAX2XMLReaderImpl.cpp (original)
+++ xerces/c/trunk/src/xercesc/parsers/SAX2XMLReaderImpl.cpp Wed Jun 25 08:55:55 2008
@@ -1304,6 +1304,10 @@
     {
         fScanner->setLoadExternalDTD(value);
     }
+    else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadSchema) == 0)
+    {
+        fScanner->setLoadSchema(value);
+    }
     else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesContinueAfterFatalError) == 0)
     {
         fScanner->setExitOnFirstFatal(!value);
@@ -1382,6 +1386,8 @@
         return fScanner->getIdentityConstraintChecking();
     else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadExternalDTD) == 0)
         return fScanner->getLoadExternalDTD();
+    else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesLoadSchema) == 0)
+        return fScanner->getLoadSchema();
     else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesContinueAfterFatalError) == 0)
         return !fScanner->getExitOnFirstFatal();
     else if (XMLString::compareIStringASCII(name, XMLUni::fgXercesValidationErrorAsFatal) == 0)

Modified: xerces/c/trunk/src/xercesc/parsers/SAX2XMLReaderImpl.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/parsers/SAX2XMLReaderImpl.hpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/parsers/SAX2XMLReaderImpl.hpp (original)
+++ xerces/c/trunk/src/xercesc/parsers/SAX2XMLReaderImpl.hpp Wed Jun 25 08:55:55 2008
@@ -278,7 +278,8 @@
     * <br>http://apache.org/xml/features/validation/reuse-grammar (default: false)
     * <br>http://apache.org/xml/features/validation/schema (default: true)
     * <br>http://apache.org/xml/features/validation/schema-full-checking (default: false)
-    * <br>http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true)
+    * <br>http://apache.org/xml/features/validating/load-schema (default: true)
+    * <br>http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true)    
     * <br>http://apache.org/xml/features/continue-after-fatal-error (default: false)
     * <br>http://apache.org/xml/features/validation-error-as-fatal (default: false)    
     *

Modified: xerces/c/trunk/src/xercesc/parsers/SAXParser.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/parsers/SAXParser.cpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/parsers/SAXParser.cpp (original)
+++ xerces/c/trunk/src/xercesc/parsers/SAXParser.cpp Wed Jun 25 08:55:55 2008
@@ -312,6 +312,11 @@
     return fScanner->getLoadExternalDTD();
 }
 
+bool SAXParser::getLoadSchema() const
+{
+    return fScanner->getLoadSchema();
+}
+
 bool SAXParser::isCachingGrammarFromParse() const
 {
     return fScanner->isCachingGrammarFromParse();
@@ -465,6 +470,11 @@
     fScanner->setLoadExternalDTD(newState);
 }
 
+void SAXParser::setLoadSchema(const bool newState)
+{
+    fScanner->setLoadSchema(newState);
+}
+
 void SAXParser::cacheGrammarFromParse(const bool newState)
 {
     fScanner->cacheGrammarFromParse(newState);

Modified: xerces/c/trunk/src/xercesc/parsers/SAXParser.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/parsers/SAXParser.hpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/parsers/SAXParser.hpp (original)
+++ xerces/c/trunk/src/xercesc/parsers/SAXParser.hpp Wed Jun 25 08:55:55 2008
@@ -377,6 +377,19 @@
       */
     bool getLoadExternalDTD() const;
 
+    /** Get the 'Loading Schema' flag
+      *
+      * This method returns the state of the parser's loading schema
+      * flag.
+      *
+      * @return true, if the parser is currently configured to
+      *         automatically load schemas that are not in the
+      *         grammar pool, false otherwise.
+      *
+      * @see #setLoadSchema
+      */
+    bool getLoadSchema() const;
+
     /** Get the 'Grammar caching' flag
       *
       * This method returns the state of the parser's grammar caching when
@@ -765,6 +778,23 @@
       */
     void setLoadExternalDTD(const bool newState);
 
+    /** Set the 'Loading Schema' flag
+      *
+      * This method allows users to enable or disable the loading of schemas.
+      * When set to false, the parser not attempt to load schemas beyond
+      * querying the grammar pool for them.
+      *
+      * The parser's default state is: true.
+      *
+      * @param newState The value specifying whether schemas should
+      *                 be loaded if they're not found in the grammar
+      *                 pool.
+      *
+      * @see #getLoadSchema
+      * @see #setDoSchema
+      */
+    void setLoadSchema(const bool newState);
+
     /** Set the 'Grammar caching' flag
       *
       * This method allows users to enable or disable caching of grammar when

Modified: xerces/c/trunk/src/xercesc/sax2/SAX2XMLReader.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/sax2/SAX2XMLReader.hpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/sax2/SAX2XMLReader.hpp (original)
+++ xerces/c/trunk/src/xercesc/sax2/SAX2XMLReader.hpp Wed Jun 25 08:55:55 2008
@@ -239,7 +239,8 @@
     * <br>http://apache.org/xml/features/validation/reuse-grammar (default: false)
     * <br>http://apache.org/xml/features/validation/schema (default: true)
     * <br>http://apache.org/xml/features/validation/schema-full-checking (default: false)
-    * <br>http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true)
+    * <br>http://apache.org/xml/features/validating/load-schema (default: true)
+    * <br>http://apache.org/xml/features/nonvalidating/load-external-dtd (default: true)    
     * <br>http://apache.org/xml/features/continue-after-fatal-error (default: false)
     * <br>http://apache.org/xml/features/validation-error-as-fatal (default: false)   
     *

Modified: xerces/c/trunk/src/xercesc/util/XMLUni.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLUni.cpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLUni.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLUni.cpp Wed Jun 25 08:55:55 2008
@@ -1026,6 +1026,21 @@
     ,   chLatin_e, chLatin_c, chLatin_k, chLatin_i, chLatin_n, chLatin_g, chNull
 };
 
+//Xerces: http://apache.org/xml/features/validating/load-schema
+const XMLCh XMLUni::fgXercesLoadSchema[] =
+{
+        chLatin_h, chLatin_t, chLatin_t, chLatin_p, chColon, chForwardSlash
+    ,   chForwardSlash, chLatin_a, chLatin_p, chLatin_a, chLatin_c, chLatin_h
+    ,   chLatin_e, chPeriod, chLatin_o, chLatin_r, chLatin_g, chForwardSlash
+    ,   chLatin_x, chLatin_m, chLatin_l, chForwardSlash, chLatin_f, chLatin_e
+    ,   chLatin_a, chLatin_t, chLatin_u, chLatin_r, chLatin_e, chLatin_s
+    ,   chForwardSlash
+    ,   chLatin_v, chLatin_a, chLatin_l, chLatin_i, chLatin_d
+    ,   chLatin_a, chLatin_t, chLatin_i, chLatin_n, chLatin_g, chForwardSlash
+    ,   chLatin_l, chLatin_o, chLatin_a, chLatin_d, chDash
+    ,   chLatin_s, chLatin_c, chLatin_h, chLatin_e, chLatin_m, chLatin_a
+};
+
 //Xerces: http://apache.org/xml/features/validation/identity-constraint-checking
 const XMLCh XMLUni::fgXercesIdentityConstraintChecking[] =
 {

Modified: xerces/c/trunk/src/xercesc/util/XMLUni.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLUni.hpp?rev=671592&r1=671591&r2=671592&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLUni.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLUni.hpp Wed Jun 25 08:55:55 2008
@@ -211,6 +211,7 @@
     static const XMLCh fgXercesDynamic[];
     static const XMLCh fgXercesSchema[];
     static const XMLCh fgXercesSchemaFullChecking[];
+    static const XMLCh fgXercesLoadSchema[];
     static const XMLCh fgXercesIdentityConstraintChecking[];
     static const XMLCh fgXercesSchemaExternalSchemaLocation[];
     static const XMLCh fgXercesSchemaExternalNoNameSpaceSchemaLocation[];



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