xerces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amass...@apache.org
Subject svn commit: r804249 - in /xerces/c/trunk/src/xercesc/validators/schema: SchemaInfo.cpp SchemaInfo.hpp TraverseSchema.cpp TraverseSchema.hpp
Date Fri, 14 Aug 2009 15:01:37 GMT
Author: amassari
Date: Fri Aug 14 15:01:36 2009
New Revision: 804249

URL: http://svn.apache.org/viewvc?rev=804249&view=rev
Log:
Move the list with the imported targetNamespace in TraverseSchema, so that a schema can "see"
what an imported schema imports (XERCESC-1249)

Modified:
    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
    xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp

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=804249&r1=804248&r2=804249&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.cpp Fri Aug 14 15:01:36 2009
@@ -55,7 +55,6 @@
     , fImportedInfoList(0)
     , fImportingInfoList(0)
     , fFailedRedefineList(0)
-    , fImportedNSList(0)
     , fRecursingAnonTypes(0)
     , fRecursingTypeNames(0)
     , fNonXSAttList(0)
@@ -93,7 +92,6 @@
         delete fIncludeInfoList;
 
     delete fImportingInfoList;
-    delete fImportedNSList;
     delete fFailedRedefineList;
     delete fRecursingAnonTypes;
     delete fRecursingTypeNames;

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=804249&r1=804248&r2=804249&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaInfo.hpp Fri Aug 14 15:01:36 2009
@@ -131,8 +131,6 @@
     bool circularImportExist(const unsigned int nameSpaceURI);
     bool isFailedRedefine(const DOMElement* const anElem);
     void addFailedRedefine(const DOMElement* const anElem);
-    bool isImportingNS(const int namespaceURI);
-    void addImportedNS(const int namespaceURI);
     void addRecursingType(const DOMElement* const elem, const XMLCh* const name);
 
 private:
@@ -164,7 +162,6 @@
     RefVectorOf<SchemaInfo>*          fImportedInfoList;
     RefVectorOf<SchemaInfo>*          fImportingInfoList;
     ValueVectorOf<const DOMElement*>* fFailedRedefineList;
-    ValueVectorOf<int>*               fImportedNSList;
     ValueVectorOf<const DOMElement*>* fRecursingAnonTypes;
     ValueVectorOf<const XMLCh*>*      fRecursingTypeNames;
     RefHashTableOf<DOMElement>*       fTopLevelComponents[C_Count];
@@ -279,16 +276,6 @@
 // ---------------------------------------------------------------------------
 //  SchemaInfo: Access methods
 // ---------------------------------------------------------------------------
-inline void SchemaInfo::addImportedNS(const int namespaceURI) {
-
-    if (!fImportedNSList) {
-        fImportedNSList = new (fMemoryManager) ValueVectorOf<int>(4, fMemoryManager);
-    }
-
-    if (!fImportedNSList->containsElement(namespaceURI))
-        fImportedNSList->addElement(namespaceURI);
-}
-
 inline void SchemaInfo::addSchemaInfo(SchemaInfo* const toAdd,
                                       const ListType aListType) {
 
@@ -300,7 +287,6 @@
         if (!fImportedInfoList->containsElement(toAdd)) {
 
             fImportedInfoList->addElement(toAdd);
-            addImportedNS(toAdd->getTargetNSURI());
             toAdd->updateImportingInfo(this);
         }
     }
@@ -407,14 +393,6 @@
     fFailedRedefineList->addElement(anElem);
 }
 
-inline bool SchemaInfo::isImportingNS(const int namespaceURI) {
-
-    if (!fImportedNSList)
-        return false;
-
-    return (fImportedNSList->containsElement(namespaceURI));
-}
-
 inline void SchemaInfo::addRecursingType(const DOMElement* const elem,
                                          const XMLCh* const name) {
 

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=804249&r1=804248&r2=804249&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.cpp Fri Aug 14 15:01:36 2009
@@ -193,6 +193,7 @@
     , fDeclStack(0)
     , fGlobalDeclarations(0)
     , fNonXSAttList(0)
+    , fImportedNSList(0)
     , fIC_NodeListNS(0)
     , fNotationRegistry(0)
     , fRedefineComponents(0)
@@ -364,6 +365,7 @@
         // Add mapping for the xml prefix
         currInfo->getNamespaceScope()->addPrefix(XMLUni::fgXMLString, fURIStringPool->addOrFind(XMLUni::fgXMLURIName));
     }
+    addImportedNS(currInfo->getTargetNSURI());
 
     fSchemaInfo = currInfo;
     fSchemaInfoList->put((void*) fSchemaInfo->getCurrentSchemaURL(), fSchemaInfo->getTargetNSURI(),
fSchemaInfo);
@@ -758,7 +760,7 @@
     bool grammarFound = (aGrammar && (aGrammar->getGrammarType() == Grammar::SchemaGrammarType));
 
     if (grammarFound) {
-        fSchemaInfo->addImportedNS(fURIStringPool->addOrFind(nameSpace));
+        addImportedNS(fURIStringPool->addOrFind(nameSpace));
     }
 
     // ------------------------------------------------------------------
@@ -787,7 +789,7 @@
     // Nothing to do
     if (!srcToFill) {
         if (!grammarFound && nameSpace) {
-            fSchemaInfo->addImportedNS(fURIStringPool->addOrFind(nameSpace));
+            addImportedNS(fURIStringPool->addOrFind(nameSpace));
         }
 
         return;
@@ -805,6 +807,7 @@
     if (importSchemaInfo) {
 
         fSchemaInfo->addSchemaInfo(importSchemaInfo, SchemaInfo::IMPORT);
+        addImportedNS(importSchemaInfo->getTargetNSURI());
         return;
     }
 
@@ -2961,7 +2964,7 @@
         // http://www.w3.org/TR/xmlschema-1/#src-resolve
         unsigned int uriId = fURIStringPool->addOrFind(uriStr);
 
-        if (!fSchemaInfo->isImportingNS(uriId)) {
+        if (!isImportingNS(uriId)) {
 
             reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference,
uriStr);
             return 0;
@@ -5012,7 +5015,7 @@
             // http://www.w3.org/TR/xmlschema-1/#src-resolve
             unsigned int uriId = fURIStringPool->addOrFind(uri);
 
-            if (!fSchemaInfo->isImportingNS(uriId)) {
+            if (!isImportingNS(uriId)) {
 
                 reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference,
uri);
                 return 0;
@@ -5283,7 +5286,7 @@
         // http://www.w3.org/TR/xmlschema-1/#src-resolve
         unsigned int uriId = fURIStringPool->addOrFind(otherSchemaURI);
 
-        if (!fSchemaInfo->isImportingNS(uriId)) {
+        if (!isImportingNS(uriId)) {
 
             reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference,
otherSchemaURI);
             return 0;
@@ -5361,7 +5364,7 @@
         // http://www.w3.org/TR/xmlschema-1/#src-resolve
         unsigned int uriId = fURIStringPool->addOrFind(typeURI);
 
-        if (!fSchemaInfo->isImportingNS(uriId)) {
+        if (!isImportingNS(uriId)) {
 
             reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference,
typeURI);
             return 0;
@@ -5427,7 +5430,7 @@
         // http://www.w3.org/TR/xmlschema-1/#src-resolve
         unsigned int uriId = fURIStringPool->addOrFind(typeURI);
 
-        if (!fSchemaInfo->isImportingNS(uriId))
+        if (!isImportingNS(uriId))
             return 0;
 
         Grammar* aGrammar = fGrammarResolver->getGrammar(typeURI);
@@ -5499,7 +5502,7 @@
         // Make sure that we have an explicit import statement.
         // Clause 4 of Schema Representation Constraint:
         // http://www.w3.org/TR/xmlschema-1/#src-resolve
-        if (!fSchemaInfo->isImportingNS(uriId))
+        if (!isImportingNS(uriId))
         {
             reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference,
nameURI);
             return 0;
@@ -5760,7 +5763,7 @@
         // http://www.w3.org/TR/xmlschema-1/#src-resolve
         unsigned int uriId = fURIStringPool->addOrFind(uriStr);
 
-        if (!fSchemaInfo->isImportingNS(uriId)) {
+        if (!isImportingNS(uriId)) {
 
             reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference,
uriStr);
             return;
@@ -6410,7 +6413,7 @@
             // http://www.w3.org/TR/xmlschema-1/#src-resolve
             unsigned int uriId = fURIStringPool->addOrFind(uriStr);
 
-            if (!fSchemaInfo->isImportingNS(uriId)) {
+            if (!isImportingNS(uriId)) {
 
                 reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference,
uriStr);
                 throw TraverseSchema::InvalidComplexTypeInfo;
@@ -7097,7 +7100,7 @@
         // http://www.w3.org/TR/xmlschema-1/#src-resolve
         unsigned int uriId = fURIStringPool->addOrFind(uriStr);
 
-        if (!fSchemaInfo->isImportingNS(uriId)) {
+        if (!isImportingNS(uriId)) {
 
             reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference,
uriStr);
             return 0;
@@ -7196,7 +7199,7 @@
         // http://www.w3.org/TR/xmlschema-1/#src-resolve
         unsigned int uriId = fURIStringPool->addOrFind(uriStr);
 
-        if (!fSchemaInfo->isImportingNS(uriId)) {
+        if (!isImportingNS(uriId)) {
 
             reportSchemaError(elem, XMLUni::fgXMLErrDomain, XMLErrs::InvalidNSReference,
uriStr);
             return 0;
@@ -8657,6 +8660,7 @@
     }
 
     delete fNonXSAttList;
+    delete fImportedNSList;
     delete fNotationRegistry;
     delete fRedefineComponents;
     delete fIdentityConstraintNames;

Modified: xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp?rev=804249&r1=804248&r2=804249&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/TraverseSchema.hpp Fri Aug 14 15:01:36 2009
@@ -237,6 +237,12 @@
     //  Private Helper methods
     // -----------------------------------------------------------------------
     /**
+      * Keep track of the xs:import found
+      */
+    bool isImportingNS(const int namespaceURI);
+    void addImportedNS(const int namespaceURI);
+
+    /**
       * Retrived the Namespace mapping from the schema element
       */
     bool retrieveNamespaceMapping(const DOMElement* const elem);
@@ -756,6 +762,7 @@
     ValueVectorOf<const DOMElement*>*              fDeclStack;
     ValueVectorOf<unsigned int>**                  fGlobalDeclarations;
     ValueVectorOf<DOMNode*>*                       fNonXSAttList;
+    ValueVectorOf<int>*                            fImportedNSList;
     RefHashTableOf<ValueVectorOf<DOMElement*>, PtrHasher>* fIC_NodeListNS;
     RefHash2KeysTableOf<XMLCh>*                    fNotationRegistry;
     RefHash2KeysTableOf<XMLCh>*                    fRedefineComponents;
@@ -916,6 +923,24 @@
     }
 }
 
+inline bool TraverseSchema::isImportingNS(const int namespaceURI) {
+
+    if (!fImportedNSList)
+        return false;
+
+    return (fImportedNSList->containsElement(namespaceURI));
+}
+
+inline void TraverseSchema::addImportedNS(const int namespaceURI) {
+
+    if (!fImportedNSList) {
+        fImportedNSList = new (fMemoryManager) ValueVectorOf<int>(4, fMemoryManager);
+    }
+
+    if (!fImportedNSList->containsElement(namespaceURI))
+        fImportedNSList->addElement(namespaceURI);
+}
+
 XERCES_CPP_NAMESPACE_END
 
 #endif



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


Mime
View raw message