You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2009/08/12 19:32:28 UTC

svn commit: r803624 - in /xerces/c/trunk/src/xercesc: NLS/EN_US/ framework/ util/MsgLoaders/ICU/resources/ util/MsgLoaders/InMemory/ util/MsgLoaders/MsgCatalog/ util/MsgLoaders/Win32/ validators/schema/

Author: amassari
Date: Wed Aug 12 17:32:28 2009
New Revision: 803624

URL: http://svn.apache.org/viewvc?rev=803624&view=rev
Log:
- Blocked substitution was not checked when defined on a complex type (XERCESC-1568)
- Blocked substitution should not be checked when xsi:type names the same original type
- Blocked substitution didn't check the bit of the restriction/extension, but it performed an equality check

Modified:
    xerces/c/trunk/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml
    xerces/c/trunk/src/xercesc/framework/XMLValidityCodes.hpp
    xerces/c/trunk/src/xercesc/util/MsgLoaders/ICU/resources/root.txt
    xerces/c/trunk/src/xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp
    xerces/c/trunk/src/xercesc/util/MsgLoaders/MsgCatalog/XercesMessages_en_US.Msg
    xerces/c/trunk/src/xercesc/util/MsgLoaders/Win32/Version.rc
    xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp

Modified: xerces/c/trunk/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml?rev=803624&r1=803623&r2=803624&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml (original)
+++ xerces/c/trunk/src/xercesc/NLS/EN_US/XMLErrList_EN_US.Xml Wed Aug 12 17:32:28 2009
@@ -405,7 +405,8 @@
             <Message Id="NoUseAbstractType" Text="type of element '{0}' is abstract; use 'xsi:type' to specify non-abstract type instead"/>
             <Message Id="BadXsiType" Text="type '{0}' specified in 'xsi:type' cannot be resolved"/>
             <Message Id="NonDerivedXsiType" Text="type '{0}' specified in 'xsi:type' does not derive from type of element '{1}'"/>
-            <Message Id="NoSubforBlock" Text="element '{0}' does not permit substitution"/>
+            <Message Id="ElemNoSubforBlock" Text="element '{0}' does not permit substitution"/>
+            <Message Id="TypeNoSubforBlock" Text="complex type '{0}' does not permit substitution"/>
             <Message Id="AttributeNotQualified" Text="attribute '{0}' must be qualified"/>
             <Message Id="AttributeNotUnQualified" Text="attribute '{0}' must be unqualified"/>
             <Message Id="IC_FieldMultipleMatch" Text="identity constraint field matches more than one value within the scope of its selector; field must match unique value"/>

Modified: xerces/c/trunk/src/xercesc/framework/XMLValidityCodes.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/framework/XMLValidityCodes.hpp?rev=803624&r1=803623&r2=803624&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/framework/XMLValidityCodes.hpp (original)
+++ xerces/c/trunk/src/xercesc/framework/XMLValidityCodes.hpp Wed Aug 12 17:32:28 2009
@@ -74,29 +74,30 @@
       , NoUseAbstractType                  = 57
       , BadXsiType                         = 58
       , NonDerivedXsiType                  = 59
-      , NoSubforBlock                      = 60
-      , AttributeNotQualified              = 61
-      , AttributeNotUnQualified            = 62
-      , IC_FieldMultipleMatch              = 63
-      , IC_UnknownField                    = 64
-      , IC_AbsentKeyValue                  = 65
-      , IC_KeyNotEnoughValues              = 66
-      , IC_KeyMatchesNillable              = 67
-      , IC_DuplicateUnique                 = 68
-      , IC_DuplicateKey                    = 69
-      , IC_KeyRefOutOfScope                = 70
-      , IC_KeyNotFound                     = 71
-      , NonWSContent                       = 72
-      , EmptyElemNotationAttr              = 73
-      , EmptyElemHasContent                = 74
-      , ElemOneNotationAttr                = 75
-      , AttrDupToken                       = 76
-      , ElemChildrenHasInvalidWS           = 77
-      , E_HighBounds                       = 78
-      , W_LowBounds                        = 79
-      , W_HighBounds                       = 80
-      , F_LowBounds                        = 81
-      , F_HighBounds                       = 82
+      , ElemNoSubforBlock                  = 60
+      , TypeNoSubforBlock                  = 61
+      , AttributeNotQualified              = 62
+      , AttributeNotUnQualified            = 63
+      , IC_FieldMultipleMatch              = 64
+      , IC_UnknownField                    = 65
+      , IC_AbsentKeyValue                  = 66
+      , IC_KeyNotEnoughValues              = 67
+      , IC_KeyMatchesNillable              = 68
+      , IC_DuplicateUnique                 = 69
+      , IC_DuplicateKey                    = 70
+      , IC_KeyRefOutOfScope                = 71
+      , IC_KeyNotFound                     = 72
+      , NonWSContent                       = 73
+      , EmptyElemNotationAttr              = 74
+      , EmptyElemHasContent                = 75
+      , ElemOneNotationAttr                = 76
+      , AttrDupToken                       = 77
+      , ElemChildrenHasInvalidWS           = 78
+      , E_HighBounds                       = 79
+      , W_LowBounds                        = 80
+      , W_HighBounds                       = 81
+      , F_LowBounds                        = 82
+      , F_HighBounds                       = 83
     };
 
     static bool isFatal(const XMLValid::Codes toCheck)

Modified: xerces/c/trunk/src/xercesc/util/MsgLoaders/ICU/resources/root.txt
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/MsgLoaders/ICU/resources/root.txt?rev=803624&r1=803623&r2=803624&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/MsgLoaders/ICU/resources/root.txt (original)
+++ xerces/c/trunk/src/xercesc/util/MsgLoaders/ICU/resources/root.txt Wed Aug 12 17:32:28 2009
@@ -354,6 +354,7 @@
 		"type '{0}' specified in 'xsi:type' cannot be resolved" ,
 		"type '{0}' specified in 'xsi:type' does not derive from type of element '{1}'" ,
 		"element '{0}' does not permit substitution" ,
+		"complex type '{0}' does not permit substitution" ,
 		"attribute '{0}' must be qualified" ,
 		"attribute '{0}' must be unqualified" ,
 		"identity constraint field matches more than one value within the scope of its selector; field must match unique value" ,

Modified: xerces/c/trunk/src/xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp?rev=803624&r1=803623&r2=803624&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp (original)
+++ xerces/c/trunk/src/xercesc/util/MsgLoaders/InMemory/XercesMessages_en_US.hpp Wed Aug 12 17:32:28 2009
@@ -707,6 +707,8 @@
       0x0074,0x0020,0x0027,0x007B,0x0031,0x007D,0x0027,0x00 }
   , { 0x0065,0x006C,0x0065,0x006D,0x0065,0x006E,0x0074,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0070,0x0065,0x0072,0x006D,0x0069,0x0074,0x0020,0x0073,0x0075,0x0062,0x0073,0x0074,
       0x0069,0x0074,0x0075,0x0074,0x0069,0x006F,0x006E,0x00 }
+  , { 0x0063,0x006F,0x006D,0x0070,0x006C,0x0065,0x0078,0x0020,0x0074,0x0079,0x0070,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0070,0x0065,0x0072,0x006D,0x0069,0x0074,0x0020,
+      0x0073,0x0075,0x0062,0x0073,0x0074,0x0069,0x0074,0x0075,0x0074,0x0069,0x006F,0x006E,0x00 }
   , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0071,0x0075,0x0061,0x006C,0x0069,0x0066,0x0069,0x0065,0x0064,0x00 }
   , { 0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0027,0x007B,0x0030,0x007D,0x0027,0x0020,0x006D,0x0075,0x0073,0x0074,0x0020,0x0062,0x0065,0x0020,0x0075,0x006E,0x0071,0x0075,0x0061,0x006C,0x0069,0x0066,0x0069,0x0065,0x0064,
       0x00 }
@@ -749,7 +751,7 @@
   , { 0x0045,0x005F,0x0045,0x006E,0x0064,0x00 }
 
 };
-const unsigned int gXMLValidityArraySize = 83;
+const unsigned int gXMLValidityArraySize = 84;
 
 const XMLCh gXMLExceptArray[][128] = 
 {

Modified: xerces/c/trunk/src/xercesc/util/MsgLoaders/MsgCatalog/XercesMessages_en_US.Msg
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/MsgLoaders/MsgCatalog/XercesMessages_en_US.Msg?rev=803624&r1=803623&r2=803624&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/MsgLoaders/MsgCatalog/XercesMessages_en_US.Msg (original)
+++ xerces/c/trunk/src/xercesc/util/MsgLoaders/MsgCatalog/XercesMessages_en_US.Msg Wed Aug 12 17:32:28 2009
@@ -343,23 +343,24 @@
 58  type '{0}' specified in 'xsi:type' cannot be resolved
 59  type '{0}' specified in 'xsi:type' does not derive from type of element '{1}'
 60  element '{0}' does not permit substitution
-61  attribute '{0}' must be qualified
-62  attribute '{0}' must be unqualified
-63  identity constraint field matches more than one value within the scope of its selector; field must match unique value
-64  unknown identity constraint field
-65  element '{0}' has identity constraint key with no value
-66  element '{0}' does not have enough values for identity constraint key '{1}'
-67  element '{0}' declares identity constraint key that matches nillable element
-68  element '{0}' declares duplicate identity constraint unique values
-69  element '{0}' declares duplicate identity constraint key values
-70  keyref '{0}' refers to out of scope key/unique
-71  identity constraint key for element '{0}' not found
-72  non-whitespace characters are not allowed in schema declarations other than appinfo and documentation
-73  element '{0}' declared EMPTY but has attribute '{1}' of type NOTATION
-74  element '{0}' declared EMPTY and cannot have content, not even entity references, comments, PIs, or whitespaces
-75  element '{0}' has more than one attribute of type NOTATION
-76  attribute '{0}' has non-distinct token '{1}'
-77  content model of element '{0}' does not allow escaped whitespaces
+61  complex type '{0}' does not permit substitution
+62  attribute '{0}' must be qualified
+63  attribute '{0}' must be unqualified
+64  identity constraint field matches more than one value within the scope of its selector; field must match unique value
+65  unknown identity constraint field
+66  element '{0}' has identity constraint key with no value
+67  element '{0}' does not have enough values for identity constraint key '{1}'
+68  element '{0}' declares identity constraint key that matches nillable element
+69  element '{0}' declares duplicate identity constraint unique values
+70  element '{0}' declares duplicate identity constraint key values
+71  keyref '{0}' refers to out of scope key/unique
+72  identity constraint key for element '{0}' not found
+73  non-whitespace characters are not allowed in schema declarations other than appinfo and documentation
+74  element '{0}' declared EMPTY but has attribute '{1}' of type NOTATION
+75  element '{0}' declared EMPTY and cannot have content, not even entity references, comments, PIs, or whitespaces
+76  element '{0}' has more than one attribute of type NOTATION
+77  attribute '{0}' has non-distinct token '{1}'
+78  content model of element '{0}' does not allow escaped whitespaces
 
 
 $set 3

Modified: xerces/c/trunk/src/xercesc/util/MsgLoaders/Win32/Version.rc
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/MsgLoaders/Win32/Version.rc?rev=803624&r1=803623&r2=803624&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/util/MsgLoaders/Win32/Version.rc (original)
+++ xerces/c/trunk/src/xercesc/util/MsgLoaders/Win32/Version.rc Wed Aug 12 17:32:28 2009
@@ -448,23 +448,24 @@
     16442             L"type '{0}' specified in 'xsi:type' cannot be resolved"
     16443             L"type '{0}' specified in 'xsi:type' does not derive from type of element '{1}'"
     16444             L"element '{0}' does not permit substitution"
-    16445             L"attribute '{0}' must be qualified"
-    16446             L"attribute '{0}' must be unqualified"
-    16447             L"identity constraint field matches more than one value within the scope of its selector; field must match unique value"
-    16448             L"unknown identity constraint field"
-    16449             L"element '{0}' has identity constraint key with no value"
-    16450             L"element '{0}' does not have enough values for identity constraint key '{1}'"
-    16451             L"element '{0}' declares identity constraint key that matches nillable element"
-    16452             L"element '{0}' declares duplicate identity constraint unique values"
-    16453             L"element '{0}' declares duplicate identity constraint key values"
-    16454             L"keyref '{0}' refers to out of scope key/unique"
-    16455             L"identity constraint key for element '{0}' not found"
-    16456             L"non-whitespace characters are not allowed in schema declarations other than appinfo and documentation"
-    16457             L"element '{0}' declared EMPTY but has attribute '{1}' of type NOTATION"
-    16458             L"element '{0}' declared EMPTY and cannot have content, not even entity references, comments, PIs, or whitespaces"
-    16459             L"element '{0}' has more than one attribute of type NOTATION"
-    16460             L"attribute '{0}' has non-distinct token '{1}'"
-    16461             L"content model of element '{0}' does not allow escaped whitespaces"
+    16445             L"complex type '{0}' does not permit substitution"
+    16446             L"attribute '{0}' must be qualified"
+    16447             L"attribute '{0}' must be unqualified"
+    16448             L"identity constraint field matches more than one value within the scope of its selector; field must match unique value"
+    16449             L"unknown identity constraint field"
+    16450             L"element '{0}' has identity constraint key with no value"
+    16451             L"element '{0}' does not have enough values for identity constraint key '{1}'"
+    16452             L"element '{0}' declares identity constraint key that matches nillable element"
+    16453             L"element '{0}' declares duplicate identity constraint unique values"
+    16454             L"element '{0}' declares duplicate identity constraint key values"
+    16455             L"keyref '{0}' refers to out of scope key/unique"
+    16456             L"identity constraint key for element '{0}' not found"
+    16457             L"non-whitespace characters are not allowed in schema declarations other than appinfo and documentation"
+    16458             L"element '{0}' declared EMPTY but has attribute '{1}' of type NOTATION"
+    16459             L"element '{0}' declared EMPTY and cannot have content, not even entity references, comments, PIs, or whitespaces"
+    16460             L"element '{0}' has more than one attribute of type NOTATION"
+    16461             L"attribute '{0}' has non-distinct token '{1}'"
+    16462             L"content model of element '{0}' does not allow escaped whitespaces"
 END
 STRINGTABLE DISCARDABLE
 BEGIN

Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp?rev=803624&r1=803623&r2=803624&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp Wed Aug 12 17:32:28 2009
@@ -573,10 +573,11 @@
                             emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName());
                             fErrorOccurred = true;
                         }
-                        else {
+                        else if(fCurrentDatatypeValidator != xsiTypeDV) 
+                        {
                             // the type is derived from ancestor
-                            if (((SchemaElementDecl*)elemDef)->getBlockSet() == SchemaSymbols::XSD_RESTRICTION) {
-                                emitError(XMLValid::NoSubforBlock, fXsiType->getRawName(), elemDef->getFullName());
+                            if ((((SchemaElementDecl*)elemDef)->getBlockSet() & SchemaSymbols::XSD_RESTRICTION) != 0) {
+                                emitError(XMLValid::ElemNoSubforBlock, elemDef->getFullName());
                                 fErrorOccurred = true;
                             }
                             if (elemDef->hasAttDefs()) {
@@ -635,10 +636,14 @@
                                     emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName());
                                     fErrorOccurred = true;
                                 }
-                                else {
+                                else if(elemTypeInfo != typeInfo) {
                                     int derivationMethod = typeInfo->getDerivedBy();
                                     if ((((SchemaElementDecl*)elemDef)->getBlockSet() & derivationMethod) != 0) {
-                                        emitError(XMLValid::NoSubforBlock, fXsiType->getRawName(), elemDef->getFullName());
+                                        emitError(XMLValid::ElemNoSubforBlock, elemDef->getFullName());
+                                        fErrorOccurred = true;
+                                    }
+                                    if ((tempType->getBlockSet() & derivationMethod) != 0) {
+                                        emitError(XMLValid::TypeNoSubforBlock, tempType->getTypeName());
                                         fErrorOccurred = true;
                                     }
                                 }
@@ -676,10 +681,11 @@
                                 emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName());
                                 fErrorOccurred = true;
                             }
-                            else {
+                            else if(fCurrentDatatypeValidator != xsiTypeDV)
+                            {
                                 // the type is derived from ancestor
-                                if (((SchemaElementDecl*)elemDef)->getBlockSet() == SchemaSymbols::XSD_RESTRICTION) {
-                                    emitError(XMLValid::NoSubforBlock, fXsiType->getRawName(), elemDef->getFullName());
+                                if ((((SchemaElementDecl*)elemDef)->getBlockSet() & SchemaSymbols::XSD_RESTRICTION) != 0) {
+                                    emitError(XMLValid::ElemNoSubforBlock, elemDef->getFullName());
                                     fErrorOccurred = true;
                                 }
                                 if (elemDef->hasAttDefs()) {



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