From 14d0bdb02dea248add93007965a742b18152daab Mon Sep 17 00:00:00 2001
From: Khaled Noaman <knoaman@apache.org>
Date: Tue, 7 Jan 2003 15:43:47 +0000
Subject: [PATCH] Errata E1-22: anyType has process contents of lax.

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@174593 13f79535-47bb-0310-9956-ffa450edef68
---
 src/xercesc/internal/IGXMLScanner.cpp            | 6 +++++-
 src/xercesc/internal/SGXMLScanner.cpp            | 7 +++++--
 src/xercesc/validators/schema/TraverseSchema.cpp | 6 +++---
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/xercesc/internal/IGXMLScanner.cpp b/src/xercesc/internal/IGXMLScanner.cpp
index c659f4098..a94f71538 100644
--- a/src/xercesc/internal/IGXMLScanner.cpp
+++ b/src/xercesc/internal/IGXMLScanner.cpp
@@ -1956,6 +1956,8 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData)
     ContentLeafNameTypeVector* cv = 0;
     XMLContentModel* cm = 0;
     int currentScope = Grammar::TOP_LEVEL_SCOPE;
+    bool laxThisOne = false;
+
     if (!isRoot && fGrammarType == Grammar::SchemaGrammarType) {
         SchemaElementDecl* tempElement = (SchemaElementDecl*) fElemStack.topElement()->fThisElement;
         SchemaElementDecl::ModelTypes modelType = tempElement->getModelType();
@@ -1968,6 +1970,9 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData)
             cv = cm->getContentLeafNameTypeVector();
             currentScope = fElemStack.getCurrentScope();
         }
+        else if (modelType == SchemaElementDecl::Any) {
+            laxThisOne = true;
+        }
     }
 
     //  Now, since we might have to update the namespace map for this element,
@@ -2042,7 +2047,6 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData)
 
     //if schema, check if we should lax or skip the validation of this element
     bool parentValidation = fValidate;
-    bool laxThisOne = false;
     if (cv) {
         QName element(fPrefixBuf.getRawBuffer(), &qnameRawBuf[prefixColonPos + 1], uriId);
         // elementDepth will be > 0, as cv is only constructed if element is not
diff --git a/src/xercesc/internal/SGXMLScanner.cpp b/src/xercesc/internal/SGXMLScanner.cpp
index 417cb4e21..67db8590f 100644
--- a/src/xercesc/internal/SGXMLScanner.cpp
+++ b/src/xercesc/internal/SGXMLScanner.cpp
@@ -1110,6 +1110,7 @@ bool SGXMLScanner::scanStartTag(bool& gotData)
     ContentLeafNameTypeVector* cv = 0;
     XMLContentModel* cm = 0;
     int currentScope = Grammar::TOP_LEVEL_SCOPE;
+    bool laxThisOne = false;
     if (!isRoot) {
 
         SchemaElementDecl* tempElement = (SchemaElementDecl*) fElemStack.topElement()->fThisElement;
@@ -1123,6 +1124,9 @@ bool SGXMLScanner::scanStartTag(bool& gotData)
             cv = cm->getContentLeafNameTypeVector();
             currentScope = fElemStack.getCurrentScope();
         }
+        else if (modelType == SchemaElementDecl::Any) {
+            laxThisOne = true;
+        }
     }
 
     //  Now, since we might have to update the namespace map for this element,
@@ -1162,7 +1166,6 @@ bool SGXMLScanner::scanStartTag(bool& gotData)
 
     //if schema, check if we should lax or skip the validation of this element
     bool parentValidation = fValidate;
-    bool laxThisOne = false;
     if (cv) {
         QName element(fPrefixBuf.getRawBuffer(), &qnameRawBuf[prefixColonPos + 1], uriId);
         // elementDepth will be > 0, as cv is only constructed if element is not
@@ -1851,7 +1854,7 @@ void SGXMLScanner::resizeElemState() {
     fElemStateSize = newSize;
 }
 
-//  This method is called from scanStartTagNS() to build up the list of
+//  This method is called from scanStartTag() to build up the list of
 //  XMLAttr objects that will be passed out in the start tag callout. We
 //  get the key/value pairs from the raw scan of explicitly provided attrs,
 //  which have not been normalized. And we get the element declaration from
diff --git a/src/xercesc/validators/schema/TraverseSchema.cpp b/src/xercesc/validators/schema/TraverseSchema.cpp
index fb4f4b9c0..6c67aaa3c 100644
--- a/src/xercesc/validators/schema/TraverseSchema.cpp
+++ b/src/xercesc/validators/schema/TraverseSchema.cpp
@@ -2599,7 +2599,7 @@ QName* TraverseSchema::traverseElementDecl(const DOMElement* const elem,
             elemDecl->setAttWildCard(new SchemaAttDef(XMLUni::fgZeroLenString,
                                                       XMLUni::fgZeroLenString,
                                                       fEmptyNamespaceURI, XMLAttDef::Any_Any,
-                                                      XMLAttDef::ProcessContents_Strict));
+                                                      XMLAttDef::ProcessContents_Lax));
         }
 
         // key/keyref/unique processing
@@ -5656,7 +5656,7 @@ void TraverseSchema::processComplexContent(const DOMElement* const ctElem,
                                                                      fEmptyNamespaceURI),
                                                            false);
 
-        anySpecNode->setType(ContentSpecNode::Any);
+        anySpecNode->setType(ContentSpecNode::Any_Lax);
         anySpecNode->setMinOccurs(0);
         anySpecNode->setMaxOccurs(SchemaSymbols::UNBOUNDED);
 
@@ -5995,7 +5995,7 @@ void TraverseSchema::processAttributes(const DOMElement* const elem,
             baseAttWildCard = new SchemaAttDef(XMLUni::fgZeroLenString,
                                                XMLUni::fgZeroLenString,
                                                fEmptyNamespaceURI, XMLAttDef::Any_Any,
-                                               XMLAttDef::ProcessContents_Strict);
+                                               XMLAttDef::ProcessContents_Lax);
             janBaseAttWildCard.reset(baseAttWildCard);
         }
 		
-- 
GitLab