You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ca...@apache.org on 2006/10/05 21:55:11 UTC
svn commit: r453341 - in /xerces/c/trunk/src/xercesc:
internal/IGXMLScanner.cpp internal/SGXMLScanner.cpp
util/XMLAbstractDoubleFloat.cpp validators/common/AllContentModel.cpp
validators/schema/SchemaValidator.cpp
Author: cargilld
Date: Thu Oct 5 12:55:10 2006
New Revision: 453341
URL: http://svn.apache.org/viewvc?view=rev&rev=453341
Log:
merge recent fixes from 2.7 branch
Modified:
xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp
xerces/c/trunk/src/xercesc/util/XMLAbstractDoubleFloat.cpp
xerces/c/trunk/src/xercesc/validators/common/AllContentModel.cpp
xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
Modified: xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp?view=diff&rev=453341&r1=453340&r2=453341
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/IGXMLScanner.cpp Thu Oct 5 12:55:10 2006
@@ -2300,8 +2300,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)
);
@@ -2338,6 +2340,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
@@ -2348,7 +2351,7 @@
);
}
}
- else if (!laxThisOne) {
+ else if (!laxThisOne && fValidate) {
fValidator->emitError(
XMLValid::GrammarNotFound,original_uriStr
);
@@ -2511,8 +2514,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);
@@ -2526,6 +2531,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/trunk/src/xercesc/internal/SGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp?view=diff&rev=453341&r1=453340&r2=453341
==============================================================================
--- xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp (original)
+++ xerces/c/trunk/src/xercesc/internal/SGXMLScanner.cpp Thu Oct 5 12:55:10 2006
@@ -1519,8 +1519,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);
@@ -1534,6 +1536,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/trunk/src/xercesc/util/XMLAbstractDoubleFloat.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/util/XMLAbstractDoubleFloat.cpp?view=diff&rev=453341&r1=453340&r2=453341
==============================================================================
--- xerces/c/trunk/src/xercesc/util/XMLAbstractDoubleFloat.cpp (original)
+++ xerces/c/trunk/src/xercesc/util/XMLAbstractDoubleFloat.cpp Thu Oct 5 12:55:10 2006
@@ -361,6 +361,7 @@
XMLCh* srcStr = inData;
bool minusSeen = false;
+ bool dotSeen = false;
// process sign if any
if (*srcStr == chDash)
@@ -380,9 +381,18 @@
ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, getMemoryManager());
}
}
+ else if (*srcStr == chPeriod)
+ {
+ dotSeen = true;
+ srcStr++;
+ if (!*srcStr)
+ {
+ ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, getMemoryManager());
+ }
+ }
// scan the string
- bool dotSeen = false;
+
bool isValidStr = true;
XMLCh theChar;
while ((theChar=*srcStr++)!=0 && isValidStr)
Modified: xerces/c/trunk/src/xercesc/validators/common/AllContentModel.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/common/AllContentModel.cpp?view=diff&rev=453341&r1=453340&r2=453341
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/common/AllContentModel.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/common/AllContentModel.cpp Thu Oct 5 12:55:10 2006
@@ -22,6 +22,7 @@
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
+#include <xercesc/util/Janitor.hpp>
#include <xercesc/util/RuntimeException.hpp>
#include <xercesc/framework/XMLElementDecl.hpp>
#include <xercesc/framework/XMLValidator.hpp>
@@ -112,8 +113,13 @@
if (childCount == 0 && (fHasOptionalContent || !fNumRequired))
return -1;
+ MemoryManager* const localMemoryManager =
+ children[0]->getMemoryManager();
+
// Check for duplicate element
- bool* elementSeen = (bool*) fMemoryManager->allocate(fCount*sizeof(bool)); //new bool[fCount];
+ bool* elementSeen = (bool*) localMemoryManager->allocate(fCount*sizeof(bool)); //new bool[fCount];
+
+ const ArrayJanitor<bool> jan(elementSeen, localMemoryManager);
// initialize the array
for (unsigned int i = 0; i < fCount; i++)
@@ -126,7 +132,7 @@
// Get the current child out of the source index
const QName* curChild = children[outIndex];
- // If its PCDATA, then we just accept that
+ // If it's PCDATA, then we just accept that
if (fIsMixed && curChild->getURI() == XMLElementDecl::fgPCDataElemId)
continue;
@@ -141,7 +147,6 @@
// If this element was seen already, indicate an error was
// found at the duplicate index.
if (elementSeen[inIndex]) {
- fMemoryManager->deallocate(elementSeen); //delete [] elementSeen;
return outIndex;
}
else
@@ -156,21 +161,17 @@
// We did not find this one, so the validation failed
if (inIndex == fCount) {
- fMemoryManager->deallocate(elementSeen); //delete [] elementSeen;
return outIndex;
}
}
- fMemoryManager->deallocate(elementSeen); //delete [] elementSeen;
-
// Were all the required elements of the <all> encountered?
if (numRequiredSeen != fNumRequired) {
return childCount;
}
// Everything seems to be ok, so return success
- // success
return -1;
}
@@ -189,8 +190,13 @@
if (childCount == 0 && (fHasOptionalContent || !fNumRequired))
return -1;
+ MemoryManager* const localMemoryManager =
+ children[0]->getMemoryManager();
+
// Check for duplicate element
- bool* elementSeen = (bool*) fMemoryManager->allocate(fCount*sizeof(bool)); //new bool[fCount];
+ bool* elementSeen = (bool*) localMemoryManager->allocate(fCount*sizeof(bool)); //new bool[fCount];
+
+ const ArrayJanitor<bool> jan(elementSeen, localMemoryManager);
// initialize the array
for (unsigned int i = 0; i < fCount; i++)
@@ -203,7 +209,7 @@
// Get the current child out of the source index
QName* const curChild = children[outIndex];
- // If its PCDATA, then we just accept that
+ // If it's PCDATA, then we just accept that
if (fIsMixed && curChild->getURI() == XMLElementDecl::fgPCDataElemId)
continue;
@@ -217,7 +223,6 @@
// If this element was seen already, indicate an error was
// found at the duplicate index.
if (elementSeen[inIndex]) {
- fMemoryManager->deallocate(elementSeen); //delete [] elementSeen;
return outIndex;
}
else
@@ -232,21 +237,17 @@
// We did not find this one, so the validation failed
if (inIndex == fCount) {
- fMemoryManager->deallocate(elementSeen); //delete [] elementSeen;
return outIndex;
}
}
- fMemoryManager->deallocate(elementSeen); //delete [] elementSeen;
-
// Were all the required elements of the <all> encountered?
if (numRequiredSeen != fNumRequired) {
return childCount;
}
// Everything seems to be ok, so return success
- // success
return -1;
}
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?view=diff&rev=453341&r1=453340&r2=453341
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp Thu Oct 5 12:55:10 2006
@@ -960,9 +960,12 @@
XMLCh nextCh;
const XMLCh* srcPtr = value;
XMLReader* fCurReader = getReaderMgr()->getCurrentReader();
-
- if ((wsFacet==DatatypeValidator::COLLAPSE) && fTrailing)
+
+ if ((wsFacet==DatatypeValidator::COLLAPSE) && fTrailing) {
+ nextCh = *srcPtr;
+ if (!fCurReader->isWhitespace(nextCh))
toFill.append(chSpace);
+ }
while (*srcPtr)
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org