Author: cargilld
Date: Thu Oct 5 12:48:42 2006
New Revision: 453337
URL: http://svn.apache.org/viewvc?view=rev&rev=453337
Log:
Handle anonymous properly.
Modified:
xerces/c/branches/xerces-2.7/src/xercesc/internal/IGXMLScanner.cpp
xerces/c/branches/xerces-2.7/src/xercesc/internal/SGXMLScanner.cpp
Modified: xerces/c/branches/xerces-2.7/src/xercesc/internal/IGXMLScanner.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/branches/xerces-2.7/src/xercesc/internal/IGXMLScanner.cpp?view=diff&rev=453337&r1=453336&r2=453337
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/internal/IGXMLScanner.cpp
(original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/internal/IGXMLScanner.cpp Thu Oct
5 12:48:42 2006
@@ -2308,8 +2308,10 @@
if (switchGrammar(getURIText(uriId))) {
checkTopLevel = true;
}
- else {
- if (!laxThisOne) {
+ else {
+ // the laxElementValidation routine (called above) will
+ // set fValidate to false for a "skipped" element
+ if (!laxThisOne && fValidate) {
fValidator->emitError(
XMLValid::GrammarNotFound, getURIText(uriId)
);
@@ -2346,6 +2348,7 @@
// go to original Grammar again to see if element needs
// to be fully qualified.
else if (uriId == fEmptyNamespaceId) {
+
if (switchGrammar(original_uriStr)) {
elemDecl = fGrammar->getElemDecl(
orgGrammarUri, nameRawBuf, qnameRawBuf,
currentScope
@@ -2356,7 +2359,7 @@
);
}
}
- else if (!laxThisOne) {
+ else if (!laxThisOne && fValidate) {
fValidator->emitError(
XMLValid::GrammarNotFound,original_uriStr
);
@@ -2519,8 +2522,10 @@
// switch grammar if the typeinfo has a different grammar (happens
when there is xsi:type)
XMLCh* typeName = typeinfo->getTypeName();
- const XMLCh poundStr[] = {chPound, chNull};
- if (!XMLString::startsWith(typeName, poundStr)) {
+ //anonymous used to have a name starting with #
+ //const XMLCh poundStr[] = {chPound, chNull};
+ //if (!XMLString::startsWith(typeName, poundStr)) {
+ if (!typeinfo->getAnonymous()) {
const int comma = XMLString::indexOf(typeName, chComma);
if (comma > 0) {
XMLBuffer prefixBuf(comma+1, fMemoryManager);
@@ -2534,6 +2539,17 @@
(
XMLValid::GrammarNotFound
, prefixBuf.getRawBuffer()
+ );
+ }
+ }
+ else if (comma == 0) {
+ bool errorCondition =
!switchGrammar(XMLUni::fgZeroLenString) && fValidate;
+ if (errorCondition && !laxThisOne)
+ {
+ fValidator->emitError
+ (
+ XMLValid::GrammarNotFound
+ , XMLUni::fgZeroLenString
);
}
}
Modified: xerces/c/branches/xerces-2.7/src/xercesc/internal/SGXMLScanner.cpp
URL:
http://svn.apache.org/viewvc/xerces/c/branches/xerces-2.7/src/xercesc/internal/SGXMLScanner.cpp?view=diff&rev=453337&r1=453336&r2=453337
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/internal/SGXMLScanner.cpp
(original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/internal/SGXMLScanner.cpp Thu Oct
5 12:48:42 2006
@@ -1517,8 +1517,10 @@
// switch grammar if the typeinfo has a different grammar (happens
when there is xsi:type)
XMLCh* typeName = typeinfo->getTypeName();
- const XMLCh poundStr[] = {chPound, chNull};
- if (!XMLString::startsWith(typeName, poundStr)) {
+ //anonymous used to have a name starting with #
+ //const XMLCh poundStr[] = {chPound, chNull};
+ //if (!XMLString::startsWith(typeName, poundStr)) {
+ if (!typeinfo->getAnonymous()) {
const int comma = XMLString::indexOf(typeName, chComma);
if (comma > 0) {
XMLBuffer prefixBuf(comma+1, fMemoryManager);
@@ -1532,6 +1534,17 @@
(
XMLValid::GrammarNotFound
, prefixBuf.getRawBuffer()
+ );
+ }
+ }
+ else if (comma == 0) {
+ bool errorCondition = !switchGrammar(XMLUni::fgZeroLenString)
&& fValidate;
+ if (errorCondition && !laxThisOne)
+ {
+ fValidator->emitError
+ (
+ XMLValid::GrammarNotFound
+ , XMLUni::fgZeroLenString
);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]