You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2003/10/05 04:15:12 UTC
cvs commit: xml-xerces/c/src/xercesc/internal IGXMLScanner.cpp IGXMLScanner2.cpp SGXMLScanner.cpp
neilg 2003/10/04 19:15:12
Modified: c/src/xercesc/internal IGXMLScanner.cpp IGXMLScanner2.cpp
SGXMLScanner.cpp
Log:
no longer query the current schema element declaration for properties that belong to a complex or simple type; instead, query the current type according to the validator. This permits xsi:type to be handled without modifying element declarations.
Revision Changes Path
1.25 +17 -9 xml-xerces/c/src/xercesc/internal/IGXMLScanner.cpp
Index: IGXMLScanner.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/IGXMLScanner.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- IGXMLScanner.cpp 1 Oct 2003 16:32:38 -0000 1.24
+++ IGXMLScanner.cpp 5 Oct 2003 02:15:12 -0000 1.25
@@ -1130,8 +1130,9 @@
// reset xsi:type ComplexTypeInfo
if (fGrammarType == Grammar::SchemaGrammarType) {
+ // REVISIT XXX: should not be necessary
((SchemaElementDecl*)topElem->fThisElement)->reset();
- if (!isRoot)
+ if (!isRoot && false)
((SchemaElementDecl*)(fElemStack.topElement()->fThisElement))->
setXsiComplexTypeInfo(((SchemaValidator*)fValidator)->getCurrentTypeInfo());
}
@@ -1882,6 +1883,7 @@
// would have have gotten faulted in anyway.
if (elemDecl->hasAttDefs())
{
+ // N.B.: this assumes DTD validation.
XMLAttDefList& attDefList = elemDecl->getAttDefList();
while (attDefList.hasMoreElements())
{
@@ -2070,14 +2072,17 @@
bool laxThisOne = false;
if (!isRoot && fGrammarType == Grammar::SchemaGrammarType) {
- SchemaElementDecl* tempElement = (SchemaElementDecl*) fElemStack.topElement()->fThisElement;
- SchemaElementDecl::ModelTypes modelType = tempElement->getModelType();
+ // schema validator will have correct type
+ ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
+ SchemaElementDecl::ModelTypes modelType = (currType)
+ ? ((SchemaElementDecl::ModelTypes)currType->getContentType())
+ : SchemaElementDecl::Simple;
if ((modelType == SchemaElementDecl::Mixed_Simple)
|| (modelType == SchemaElementDecl::Mixed_Complex)
|| (modelType == SchemaElementDecl::Children))
{
- cm = tempElement->getContentModel();
+ cm = currType->getContentModel();
cv = cm->getContentLeafNameTypeVector();
currentScope = fElemStack.getCurrentScope();
}
@@ -2122,7 +2127,8 @@
, Grammar::TOP_LEVEL_SCOPE
);
// may have not been declared:
- elemDecl = fDTDElemNonDeclPool->getByKey(rawQName);
+ if(!elemDecl)
+ elemDecl = fDTDElemNonDeclPool->getByKey(rawQName);
if (elemDecl) {
if (elemDecl->hasAttDefs()) {
XMLAttDefList& attDefList = elemDecl->getAttDefList();
@@ -2496,7 +2502,8 @@
}
}
- if (fGrammarType == Grammar::SchemaGrammarType) {
+ // REVISIT: XXX not necessary
+ if (fGrammarType == Grammar::SchemaGrammarType && false) {
((SchemaElementDecl*)elemDecl)->setXsiComplexTypeInfo(0);
((SchemaElementDecl*)elemDecl)->setXsiSimpleTypeInfo(0);
}
@@ -2521,7 +2528,7 @@
fValidator->validateElement(elemDecl);
if (fGrammarType == Grammar::SchemaGrammarType) {
- ComplexTypeInfo* typeinfo = ((SchemaElementDecl*)elemDecl)->getComplexTypeInfo();
+ ComplexTypeInfo* typeinfo = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
if (typeinfo) {
currentScope = typeinfo->getScopeDefined();
@@ -2742,8 +2749,9 @@
// reset xsi:type ComplexTypeInfo
if (fGrammarType == Grammar::SchemaGrammarType) {
+ // REVISIT XXX: should not be necessary
((SchemaElementDecl*)elemDecl)->reset();
- if (!isRoot)
+ if (!isRoot && false)
((SchemaElementDecl*)(fElemStack.topElement()->fThisElement))->
setXsiComplexTypeInfo(((SchemaValidator*)fValidator)->getCurrentTypeInfo());
}
1.32 +79 -20 xml-xerces/c/src/xercesc/internal/IGXMLScanner2.cpp
Index: IGXMLScanner2.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/IGXMLScanner2.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- IGXMLScanner2.cpp 1 Oct 2003 01:09:34 -0000 1.31
+++ IGXMLScanner2.cpp 5 Oct 2003 02:15:12 -0000 1.32
@@ -110,10 +110,17 @@
, XMLElementDecl* elemDecl
, RefVectorOf<XMLAttr>& toFill)
{
- // Ask the element to clear the 'provided' flag on all of the att defs
+ // If doing DTD's, Ask the element to clear the 'provided' flag on all of the att defs
// that it owns, and to return us a boolean indicating whether it has
- // any defs.
- const bool hasDefs = elemDecl->resetDefs();
+ // any defs. If schemas are being validated, the complexType
+ // at the top of the SchemaValidator's stack will
+ // know what's best. REVISIT: don't modify grammar at all...
+ ComplexTypeInfo *currType = 0;
+ if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType)
+ currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
+ const bool hasDefs = (currType && fValidate)
+ ? currType->resetDefs()
+ : elemDecl->resetDefs();
// If there are no expliclitily provided attributes and there are no
// defined attributes for the element, the we don't have anything to do.
@@ -201,17 +208,21 @@
XMLAttDef* attDefForWildCard = 0;
XMLAttDef* attDef = 0;
- if (fGrammarType == Grammar::SchemaGrammarType) {
+ if (fGrammarType == Grammar::SchemaGrammarType && currType) {
//retrieve the att def
- attDef = ((SchemaElementDecl*)elemDecl)->getAttDef(suffPtr, uriId);
+ // currType must be non-null for schema grammars
+ attDef = currType->getAttDef(suffPtr, uriId);
// if not found or faulted in - check for a matching wildcard attribute
// if no matching wildcard attribute, check (un)qualifed cases and flag
// appropriate errors
if (!attDef || (attDef->getCreateReason() == XMLAttDef::JustFaultIn)) {
- SchemaAttDef* attWildCard = ((SchemaElementDecl*)elemDecl)->getAttWildCard();
+ SchemaAttDef* attWildCard = currType->getAttWildCard();
+ if(!attWildCard)
+ // check explicitly-set wildcard
+ attWildCard = ((SchemaElementDecl*)elemDecl)->getAttWildCard();
if (attWildCard) {
//if schema, see if we should lax or skip the validation of this attribute
@@ -229,7 +240,8 @@
else {
// not found, see if the attDef should be qualified or not
if (uriId == fEmptyNamespaceId) {
- attDef = ((SchemaElementDecl*)elemDecl)->getAttDef(suffPtr, fURIStringPool->getId(fGrammar->getTargetNamespace()));
+ attDef = currType->getAttDef(suffPtr
+ , fURIStringPool->getId(fGrammar->getTargetNamespace()));
if (fValidate
&& attDef
&& attDef->getCreateReason() != XMLAttDef::JustFaultIn) {
@@ -245,7 +257,8 @@
}
}
else {
- attDef = ((SchemaElementDecl*)elemDecl)->getAttDef(suffPtr, fEmptyNamespaceId);
+ attDef = currType->getAttDef(suffPtr
+ , fEmptyNamespaceId);
if (fValidate
&& attDef
&& attDef->getCreateReason() != XMLAttDef::JustFaultIn) {
@@ -521,7 +534,9 @@
// Check after all specified attrs are scanned
// (1) report error for REQUIRED attrs that are missing (V_TAGc)
// (2) add default attrs if missing (FIXED and NOT_FIXED)
- XMLAttDefList& attDefList = elemDecl->getAttDefList();
+ XMLAttDefList &attDefList = (fGrammarType == Grammar::SchemaGrammarType)
+ ? (((SchemaValidator*)fValidator)->getCurrentTypeInfo()->getAttDefList())
+ : (elemDecl->getAttDefList());
while (attDefList.hasMoreElements())
{
// Get the current att def, for convenience and its def type
@@ -1031,7 +1046,21 @@
const ElemStack::StackElem* topElem = fElemStack.topElement();
// Get the character data opts for the current element
- XMLElementDecl::CharDataOpts charOpts = topElem->fThisElement->getCharDataOpts();
+ XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
+ if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType)
+ {
+ // And see if the current element is a 'Children' style content model
+ ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
+ if(currType)
+ {
+ SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();
+ if(modelType == SchemaElementDecl::Children)
+ charOpts = XMLElementDecl::SpacesOk;
+ else if(modelType == SchemaElementDecl::Empty)
+ charOpts = XMLElementDecl::NoCharData;
+ }
+ } else // DTD grammar
+ charOpts = topElem->fThisElement->getCharDataOpts();
if (charOpts == XMLElementDecl::NoCharData)
{
@@ -1058,9 +1087,10 @@
}
else
{
+ SchemaValidator *schemaValidator = (SchemaValidator *)fValidator;
if (fNormalizeData) {
- DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator();
+ DatatypeValidator* tempDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator();
if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE)
{
// normalize the character according to schema whitespace facet
@@ -1074,7 +1104,7 @@
}
// tell the schema validation about the character data for checkContent later
- ((SchemaValidator*) fValidator)->setDatatypeBuffer(rawBuf);
+ schemaValidator->setDatatypeBuffer(rawBuf);
// call all active identity constraints
if (fMatcherStack->getMatcherCount())
@@ -1099,9 +1129,10 @@
}
else
{
+ SchemaValidator *schemaValidator = (SchemaValidator*)fValidator;
if (fNormalizeData) {
- DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator();
+ DatatypeValidator* tempDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator();
if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE)
{
// normalize the character according to schema whitespace facet
@@ -1115,7 +1146,7 @@
}
// tell the schema validation about the character data for checkContent later
- ((SchemaValidator*) fValidator)->setDatatypeBuffer(rawBuf);
+ schemaValidator->setDatatypeBuffer(rawBuf);
// call all active identity constraints
if (fMatcherStack->getMatcherCount())
@@ -2069,10 +2100,24 @@
// characters specially here.
bool emittedError = false;
bool gotLeadingSurrogate = false;
+ const ElemStack::StackElem* topElem = fElemStack.topElement();
// Get the character data opts for the current element
- const ElemStack::StackElem* topElem = fElemStack.topElement();
- XMLElementDecl::CharDataOpts charOpts = topElem->fThisElement->getCharDataOpts();
+ XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
+ if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType)
+ {
+ // And see if the current element is a 'Children' style content model
+ ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
+ if(currType)
+ {
+ SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();
+ if(modelType == SchemaElementDecl::Children)
+ charOpts = XMLElementDecl::SpacesOk;
+ else if(modelType == SchemaElementDecl::Empty)
+ charOpts = XMLElementDecl::NoCharData;
+ }
+ } else // DTD grammar
+ charOpts = topElem->fThisElement->getCharDataOpts();
while (true)
{
@@ -2115,7 +2160,7 @@
if (fNormalizeData)
{
- DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator();
+ DatatypeValidator* tempDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator();
if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE)
{
// normalize the character according to schema whitespace facet
@@ -2130,7 +2175,7 @@
if (fValidate) {
// tell the schema validation about the character data for checkContent later
- ((SchemaValidator*) fValidator)->setDatatypeBuffer(bbCData.getRawBuffer());
+ ((SchemaValidator*)fValidator)->setDatatypeBuffer(bbCData.getRawBuffer());
if (charOpts != XMLElementDecl::AllCharData)
{
@@ -2408,7 +2453,21 @@
if (topElem->fThisElement->isExternal()) {
// Get the character data opts for the current element
- XMLElementDecl::CharDataOpts charOpts = topElem->fThisElement->getCharDataOpts();
+ XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
+ if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType)
+ {
+ // And see if the current element is a 'Children' style content model
+ ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
+ if(currType)
+ {
+ SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();
+ if(modelType == SchemaElementDecl::Children)
+ charOpts = XMLElementDecl::SpacesOk;
+ else if(modelType == SchemaElementDecl::Empty)
+ charOpts = XMLElementDecl::NoCharData;
+ }
+ } else // DTD grammar
+ charOpts = topElem->fThisElement->getCharDataOpts();
if (charOpts == XMLElementDecl::SpacesOk) // => Element Content
{
1.38 +72 -28 xml-xerces/c/src/xercesc/internal/SGXMLScanner.cpp
Index: SGXMLScanner.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/SGXMLScanner.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- SGXMLScanner.cpp 1 Oct 2003 16:32:38 -0000 1.37
+++ SGXMLScanner.cpp 5 Oct 2003 02:15:12 -0000 1.38
@@ -1060,8 +1060,10 @@
// reset xsi:type ComplexTypeInfo
+ // REVISIT mutability!
((SchemaElementDecl*)topElem->fThisElement)->reset();
- if (!isRoot)
+ // XXX
+ if (!isRoot && false)
((SchemaElementDecl*)(fElemStack.topElement()->fThisElement))->
setXsiComplexTypeInfo(((SchemaValidator*)fValidator)->getCurrentTypeInfo());
@@ -1150,15 +1152,17 @@
int currentScope = Grammar::TOP_LEVEL_SCOPE;
bool laxThisOne = false;
if (!isRoot) {
-
- SchemaElementDecl* tempElement = (SchemaElementDecl*) fElemStack.topElement()->fThisElement;
- SchemaElementDecl::ModelTypes modelType = tempElement->getModelType();
+ // schema validator will have correct type
+ ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
+ SchemaElementDecl::ModelTypes modelType = (currType)
+ ? ((SchemaElementDecl::ModelTypes)currType->getContentType())
+ : SchemaElementDecl::Simple;
if ((modelType == SchemaElementDecl::Mixed_Simple)
|| (modelType == SchemaElementDecl::Mixed_Complex)
|| (modelType == SchemaElementDecl::Children))
{
- cm = tempElement->getContentModel();
+ cm = currType->getContentModel();
cv = cm->getContentLeafNameTypeVector();
currentScope = fElemStack.getCurrentScope();
}
@@ -1492,6 +1496,7 @@
}
}
+ // XXX REVISIT: should not be necessary
((SchemaElementDecl*)elemDecl)->setXsiComplexTypeInfo(0);
((SchemaElementDecl*)elemDecl)->setXsiSimpleTypeInfo(0);
}
@@ -1515,7 +1520,7 @@
fValidator->validateElement(elemDecl);
- ComplexTypeInfo* typeinfo = ((SchemaElementDecl*)elemDecl)->getComplexTypeInfo();
+ ComplexTypeInfo* typeinfo = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
if (typeinfo) {
currentScope = typeinfo->getScopeDefined();
@@ -1646,6 +1651,8 @@
const int res = fValidator->checkContent(elemDecl, 0, 0);
if (res >= 0)
{
+ // REVISIT: in the case of xsi:type, this may
+ // return the wrong string...
fValidator->emitError
(
XMLValid::ElementNotValidForContent
@@ -1717,8 +1724,9 @@
}
// reset xsi:type ComplexTypeInfo
+ // REVISIT XXX; should not be necessary
((SchemaElementDecl*)elemDecl)->reset();
- if (!isRoot)
+ if (!isRoot && false)
((SchemaElementDecl*)(fElemStack.topElement()->fThisElement))->
setXsiComplexTypeInfo(((SchemaValidator*)fValidator)->getCurrentTypeInfo());
@@ -2014,7 +2022,10 @@
// Ask the element to clear the 'provided' flag on all of the att defs
// that it owns, and to return us a boolean indicating whether it has
// any defs.
- const bool hasDefs = elemDecl->resetDefs();
+ ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
+ const bool hasDefs = (currType && fValidate)
+ ? currType->resetDefs()
+ : elemDecl->resetDefs();
// If there are no expliclitily provided attributes and there are no
// defined attributes for the element, the we don't have anything to do.
@@ -2102,17 +2113,20 @@
XMLAttDef* attDefForWildCard = 0;
XMLAttDef* attDef = 0;
- if (fGrammarType == Grammar::SchemaGrammarType) {
+ if (fGrammarType == Grammar::SchemaGrammarType && currType) {
//retrieve the att def
- attDef = ((SchemaElementDecl*)elemDecl)->getAttDef(suffPtr, uriId);
+ attDef = currType->getAttDef(suffPtr, uriId);
// if not found or faulted in - check for a matching wildcard attribute
// if no matching wildcard attribute, check (un)qualifed cases and flag
// appropriate errors
if (!attDef || (attDef->getCreateReason() == XMLAttDef::JustFaultIn)) {
- SchemaAttDef* attWildCard = ((SchemaElementDecl*)elemDecl)->getAttWildCard();
+ SchemaAttDef* attWildCard = currType->getAttWildCard();
+ if(!attWildCard)
+ // check explicitly-set wildcard
+ attWildCard = ((SchemaElementDecl*)elemDecl)->getAttWildCard();
if (attWildCard) {
//if schema, see if we should lax or skip the validation of this attribute
@@ -2130,7 +2144,7 @@
else {
// not found, see if the attDef should be qualified or not
if (uriId == fEmptyNamespaceId) {
- attDef = ((SchemaElementDecl*)elemDecl)->getAttDef(suffPtr, fURIStringPool->getId(fGrammar->getTargetNamespace()));
+ attDef = currType->getAttDef(suffPtr, fURIStringPool->getId(fGrammar->getTargetNamespace()));
if (fValidate
&& attDef
&& attDef->getCreateReason() != XMLAttDef::JustFaultIn) {
@@ -2144,7 +2158,7 @@
}
}
else {
- attDef = ((SchemaElementDecl*)elemDecl)->getAttDef(suffPtr, fEmptyNamespaceId);
+ attDef = currType->getAttDef(suffPtr, fEmptyNamespaceId);
if (fValidate
&& attDef
&& attDef->getCreateReason() != XMLAttDef::JustFaultIn) {
@@ -2390,7 +2404,7 @@
// Check after all specified attrs are scanned
// (1) report error for REQUIRED attrs that are missing (V_TAGc)
// (2) add default attrs if missing (FIXED and NOT_FIXED)
- XMLAttDefList& attDefList = elemDecl->getAttDefList();
+ XMLAttDefList& attDefList = ((SchemaValidator*)fValidator)->getCurrentTypeInfo()->getAttDefList();
while (attDefList.hasMoreElements())
{
// Get the current att def, for convenience and its def type
@@ -2853,12 +2867,22 @@
const XMLCh* const rawBuf = toSend.getRawBuffer();
const unsigned int len = toSend.getLen();
- // And see if the current element is a 'Children' style content model
- const ElemStack::StackElem* topElem = fElemStack.topElement();
-
// Get the character data opts for the current element
- XMLElementDecl::CharDataOpts charOpts = topElem->fThisElement->getCharDataOpts();
-
+ XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
+ // And see if the current element is a 'Children' style content model
+ ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
+ if(currType)
+ {
+ SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();
+ if(modelType == SchemaElementDecl::Children)
+ charOpts = XMLElementDecl::SpacesOk;
+ else if(modelType == SchemaElementDecl::Empty)
+ charOpts = XMLElementDecl::NoCharData;
+ }
+
+ // should not be necessary once PSVI method on element decls
+ // are removed
+ const ElemStack::StackElem *topElem = fElemStack.topElement();
if (charOpts == XMLElementDecl::NoCharData)
{
// They definitely cannot handle any type of char data
@@ -2884,7 +2908,7 @@
if (fNormalizeData)
{
- DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator();
+ DatatypeValidator* tempDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator();
if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE)
{
// normalize the character according to schema whitespace facet
@@ -2897,7 +2921,7 @@
}
// tell the schema validation about the character data for checkContent later
- ((SchemaValidator*) fValidator)->setDatatypeBuffer(toFill.getRawBuffer());
+ ((SchemaValidator*)fValidator)->setDatatypeBuffer(toFill.getRawBuffer());
// call all active identity constraints
if (fMatcherStack->getMatcherCount())
@@ -2922,7 +2946,7 @@
if (fNormalizeData)
{
- DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator();
+ DatatypeValidator* tempDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator();
if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE)
{
// normalize the character according to schema whitespace facet
@@ -2935,7 +2959,7 @@
}
// tell the schema validation about the character data for checkContent later
- ((SchemaValidator*) fValidator)->setDatatypeBuffer(toFill.getRawBuffer());
+ ((SchemaValidator*)fValidator)->setDatatypeBuffer(toFill.getRawBuffer());
// call all active identity constraints
if (fMatcherStack->getMatcherCount())
@@ -3634,8 +3658,20 @@
bool gotLeadingSurrogate = false;
// Get the character data opts for the current element
+ XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
+ // And see if the current element is a 'Children' style content model
+ ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
+ if(currType)
+ {
+ SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();
+ if(modelType == SchemaElementDecl::Children)
+ charOpts = XMLElementDecl::SpacesOk;
+ else if(modelType == SchemaElementDecl::Empty)
+ charOpts = XMLElementDecl::NoCharData;
+ }
+
+ // should not be necessary when PSVI on element decl removed
const ElemStack::StackElem* topElem = fElemStack.topElement();
- XMLElementDecl::CharDataOpts charOpts = topElem->fThisElement->getCharDataOpts();
while (true)
{
@@ -3677,7 +3713,7 @@
if (fNormalizeData)
{
- DatatypeValidator* tempDV = ((SchemaElementDecl*) topElem->fThisElement)->getDatatypeValidator();
+ DatatypeValidator* tempDV = ((SchemaValidator*) fValidator)->getCurrentDatatypeValidator();
if (tempDV && tempDV->getWSFacet() != DatatypeValidator::PRESERVE)
{
// normalize the character according to schema whitespace facet
@@ -3690,7 +3726,7 @@
}
// tell the schema validation about the character data for checkContent later
- ((SchemaValidator*) fValidator)->setDatatypeBuffer(bbCData.getRawBuffer());
+ ((SchemaValidator*)fValidator)->setDatatypeBuffer(bbCData.getRawBuffer());
if (charOpts != XMLElementDecl::AllCharData)
{
@@ -3958,7 +3994,15 @@
if (topElem->fThisElement->isExternal()) {
// Get the character data opts for the current element
- XMLElementDecl::CharDataOpts charOpts = topElem->fThisElement->getCharDataOpts();
+ XMLElementDecl::CharDataOpts charOpts = XMLElementDecl::AllCharData;
+ // And see if the current element is a 'Children' style content model
+ ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
+ if(currType)
+ {
+ SchemaElementDecl::ModelTypes modelType = (SchemaElementDecl::ModelTypes) currType->getContentType();
+ if(modelType == SchemaElementDecl::Children)
+ charOpts = XMLElementDecl::SpacesOk;
+ }
if (charOpts == XMLElementDecl::SpacesOk) // => Element Content
{
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org