knoaman 2004/12/09 12:31:39
Modified: c/src/xercesc/internal IGXMLScanner2.cpp SGXMLScanner.cpp
XMLScanner.cpp XMLScanner.hpp
Log:
DOM L3: pass schema normalized value only when datatype-normalization feature
is enabled.
Revision Changes Path
1.77 +100 -102 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.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- IGXMLScanner2.cpp 3 Dec 2004 19:40:30 -0000 1.76
+++ IGXMLScanner2.cpp 9 Dec 2004 20:31:39 -0000 1.77
@@ -420,36 +420,27 @@
// don't care about the return status here. If it failed, an
error
// was issued, which is all we care about.
if (attDefForWildCard) {
- normalizeAttValue
- (
- attDefForWildCard
- , namePtr
- , curPair->getValue()
- , normBuf
+ normalizeAttValue(
+ attDefForWildCard, namePtr, curPair->getValue(), normBuf
);
// If we found an attdef for this one, then lets validate
it.
- if (fNormalizeData)
- {
- DatatypeValidator* tempDV = ((SchemaAttDef*)
attDefForWildCard)->getDatatypeValidator();
- if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
- {
- // normalize the attribute according to schema
whitespace facet
- XMLBufBid bbtemp(&fBufMgr);
- XMLBuffer& tempBuf = bbtemp.getBuffer();
+ const XMLCh* xsNormalized = normBuf.getRawBuffer();
+ DatatypeValidator* tempDV = ((SchemaAttDef*)
attDefForWildCard)->getDatatypeValidator();
+ if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
+ {
+ // normalize the attribute according to schema
whitespace facet
+ ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, xsNormalized, fWSNormalizeBuf);
+ xsNormalized = fWSNormalizeBuf.getRawBuffer();
- ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, normBuf.getRawBuffer(), tempBuf);
- normBuf.set(tempBuf.getRawBuffer());
+ if (fNormalizeData && fValidate) {
+ normBuf.set(xsNormalized);
}
}
if (fValidate ) {
- fValidator->validateAttrValue
- (
- attDefForWildCard
- , normBuf.getRawBuffer()
- , false
- , elemDecl
+ fValidator->validateAttrValue(
+ attDefForWildCard, xsNormalized, false, elemDecl
);
attrValidator =
((SchemaValidator*)fValidator)->getMostRecentAttrValidator();
if(((SchemaValidator *)fValidator)->getErrorOccurred())
@@ -459,46 +450,40 @@
attrValid = PSVIItem::VALIDITY_INVALID;
}
}
- else // no decl; default DOMTypeInfo to anySimpleType
+ else { // no decl; default DOMTypeInfo to anySimpleType
attrValidator =
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
+ }
// Save the type for later use
attType = attDefForWildCard->getType();
}
else {
- normalizeAttValue
- (
- attDef
- , namePtr
- , curPair->getValue()
- , normBuf
+ normalizeAttValue(
+ attDef, namePtr, curPair->getValue(), normBuf
);
// If we found an attdef for this one, then lets validate
it.
if (attDef)
{
- if (fNormalizeData && (fGrammarType ==
Grammar::SchemaGrammarType))
+ const XMLCh* xsNormalized = normBuf.getRawBuffer();
+ if (fGrammarType == Grammar::SchemaGrammarType)
{
DatatypeValidator* tempDV = ((SchemaAttDef*)
attDef)->getDatatypeValidator();
if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
{
// normalize the attribute according to schema
whitespace facet
- XMLBufBid bbtemp(&fBufMgr);
- XMLBuffer& tempBuf = bbtemp.getBuffer();
-
- ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, normBuf.getRawBuffer(), tempBuf);
- normBuf.set(tempBuf.getRawBuffer());
+ ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, xsNormalized, fWSNormalizeBuf);
+ xsNormalized = fWSNormalizeBuf.getRawBuffer();
+ if (fNormalizeData && fValidate && !skipThisOne)
{
+ normBuf.set(xsNormalized);
+ }
}
}
if (fValidate && !skipThisOne)
{
- fValidator->validateAttrValue
- (
- attDef
- , normBuf.getRawBuffer()
- , false
- , elemDecl
+ fValidator->validateAttrValue(
+ attDef, xsNormalized, false, elemDecl
);
if(fGrammarType == Grammar::SchemaGrammarType)
@@ -512,13 +497,15 @@
}
}
}
- else if(fGrammarType == Grammar::SchemaGrammarType)
+ else if(fGrammarType == Grammar::SchemaGrammarType) {
attrValidator =
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
+ }
}
else // no attDef at all; default to anySimpleType
{
- if(fGrammarType == Grammar::SchemaGrammarType)
+ if(fGrammarType == Grammar::SchemaGrammarType) {
attrValidator =
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
+ }
}
// Save the type for later use
@@ -1310,7 +1297,7 @@
if (fValidate)
{
// Get the raw data we need for the callback
- XMLCh* rawBuf = toSend.getRawBuffer();
+ const XMLCh* rawBuf = toSend.getRawBuffer();
unsigned int len = toSend.getLen();
// And see if the current element is a 'Children' style content model
@@ -1364,31 +1351,38 @@
}
else
{
+ unsigned int xsLen;
+ const XMLCh* xsNormalized;
SchemaValidator *schemaValidator = (SchemaValidator
*)fValidator;
- if (fNormalizeData) {
-
- DatatypeValidator* tempDV = ((SchemaValidator*)
fValidator)->getCurrentDatatypeValidator();
- if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
- {
- // normalize the character according to schema
whitespace facet
- XMLBufBid bbtemp(&fBufMgr);
- XMLBuffer& tempBuf = bbtemp.getBuffer();
-
- ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, rawBuf, tempBuf);
- rawBuf = tempBuf.getRawBuffer();
- len = tempBuf.getLen();
- }
+ DatatypeValidator* tempDV = ((SchemaValidator*)
fValidator)->getCurrentDatatypeValidator();
+ if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
+ {
+ // normalize the character according to schema
whitespace facet
+ ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, rawBuf, fWSNormalizeBuf);
+ xsNormalized = fWSNormalizeBuf.getRawBuffer();
+ xsLen = fWSNormalizeBuf.getLen();
+ }
+ else {
+ xsNormalized = rawBuf;
+ xsLen = len ;
}
// tell the schema validation about the character data
for checkContent later
- schemaValidator->setDatatypeBuffer(rawBuf);
+ schemaValidator->setDatatypeBuffer(xsNormalized);
// call all active identity constraints
- if (toCheckIdentityConstraint() &&
fICHandler->getMatcherCount())
- fContent.append(rawBuf, len);
+ if (toCheckIdentityConstraint() &&
fICHandler->getMatcherCount()) {
+ fContent.append(xsNormalized, xsLen);
+ }
- if (fDocHandler)
- fDocHandler->docCharacters(rawBuf, len, false);
+ if (fDocHandler) {
+ if (fNormalizeData) {
+ fDocHandler->docCharacters(xsNormalized, xsLen,
false);
+ }
+ else {
+ fDocHandler->docCharacters(rawBuf, len, false);
+ }
+ }
}
}
}
@@ -1406,31 +1400,38 @@
}
else
{
+ unsigned int xsLen;
+ const XMLCh* xsNormalized;
SchemaValidator *schemaValidator =
(SchemaValidator*)fValidator;
- if (fNormalizeData) {
-
- DatatypeValidator* tempDV = ((SchemaValidator*)
fValidator)->getCurrentDatatypeValidator();
- if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
- {
- // normalize the character according to schema
whitespace facet
- XMLBufBid bbtemp(&fBufMgr);
- XMLBuffer& tempBuf = bbtemp.getBuffer();
-
- ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, rawBuf, tempBuf);
- rawBuf = tempBuf.getRawBuffer();
- len = tempBuf.getLen();
- }
+ DatatypeValidator* tempDV = ((SchemaValidator*)
fValidator)->getCurrentDatatypeValidator();
+ if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
+ {
+ // normalize the character according to schema
whitespace facet
+ ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, rawBuf, fWSNormalizeBuf);
+ xsNormalized = fWSNormalizeBuf.getRawBuffer();
+ xsLen = fWSNormalizeBuf.getLen();
+ }
+ else {
+ xsNormalized = rawBuf;
+ xsLen = len;
}
// tell the schema validation about the character data
for checkContent later
- schemaValidator->setDatatypeBuffer(rawBuf);
+ schemaValidator->setDatatypeBuffer(xsNormalized);
// call all active identity constraints
- if (toCheckIdentityConstraint() &&
fICHandler->getMatcherCount())
- fContent.append(rawBuf, len);
+ if (toCheckIdentityConstraint() &&
fICHandler->getMatcherCount()) {
+ fContent.append(xsNormalized, xsLen);
+ }
- if (fDocHandler)
- fDocHandler->docCharacters(rawBuf, len, false);
+ if (fDocHandler) {
+ if (fNormalizeData) {
+ fDocHandler->docCharacters(xsNormalized, xsLen,
false);
+ }
+ else {
+ fDocHandler->docCharacters(rawBuf, len, false);
+ }
+ }
}
}
else
@@ -2460,24 +2461,24 @@
if (fGrammarType == Grammar::SchemaGrammarType) {
- if (fNormalizeData)
- {
- DatatypeValidator* tempDV = ((SchemaValidator*)
fValidator)->getCurrentDatatypeValidator();
- if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
- {
- // normalize the character according to schema
whitespace facet
- XMLBufBid bbtemp(&fBufMgr);
- XMLBuffer& tempBuf = bbtemp.getBuffer();
-
- ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, bbCData.getRawBuffer(), tempBuf);
- bbCData.set(tempBuf.getRawBuffer());
+ unsigned int xsLen = bbCData.getLen();
+ const XMLCh* xsNormalized = bbCData.getRawBuffer();
+ DatatypeValidator* tempDV = ((SchemaValidator*)
fValidator)->getCurrentDatatypeValidator();
+ if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
+ {
+ // normalize the character according to schema
whitespace facet
+ ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, xsNormalized, fWSNormalizeBuf);
+ xsNormalized = fWSNormalizeBuf.getRawBuffer();
+ xsLen = fWSNormalizeBuf.getLen();
+ if (fNormalizeData && fValidate) {
+ bbCData.set(xsNormalized);
}
}
if (fValidate) {
// tell the schema validation about the character data
for checkContent later
-
((SchemaValidator*)fValidator)->setDatatypeBuffer(bbCData.getRawBuffer());
+
((SchemaValidator*)fValidator)->setDatatypeBuffer(xsNormalized);
if (charOpts != XMLElementDecl::AllCharData)
{
@@ -2492,9 +2493,9 @@
}
// call all active identity constraints
- if (toCheckIdentityConstraint() &&
fICHandler->getMatcherCount())
- fContent.append(bbCData.getRawBuffer(),
bbCData.getLen());
-
+ if (toCheckIdentityConstraint() &&
fICHandler->getMatcherCount()) {
+ fContent.append(xsNormalized, xsLen);
+ }
}
else {
if (fValidate) {
@@ -2510,12 +2511,9 @@
// If we have a doc handler, call it
if (fDocHandler)
{
- fDocHandler->docCharacters
- (
- bbCData.getRawBuffer()
- , bbCData.getLen()
- , true
- );
+ fDocHandler->docCharacters(
+ bbCData.getRawBuffer(), bbCData.getLen(), true
+ );
}
// And we are done
1.102 +105 -112 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.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- SGXMLScanner.cpp 3 Dec 2004 19:40:30 -0000 1.101
+++ SGXMLScanner.cpp 9 Dec 2004 20:31:39 -0000 1.102
@@ -2371,36 +2371,29 @@
// don't care about the return status here. If it failed, an
error
// was issued, which is all we care about.
if (attDefForWildCard) {
- normalizeAttValue
- (
- attDefForWildCard
- , namePtr
- , curPair->getValue()
- , normBuf
+ normalizeAttValue(
+ attDefForWildCard, namePtr, curPair->getValue(), normBuf
);
// If we found an attdef for this one, then lets validate
it.
- if (fNormalizeData)
- {
- DatatypeValidator* tempDV = ((SchemaAttDef*)
attDefForWildCard)->getDatatypeValidator();
- if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
- {
- // normalize the attribute according to schema
whitespace facet
- XMLBufBid bbtemp(&fBufMgr);
- XMLBuffer& tempBuf = bbtemp.getBuffer();
-
- ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, normBuf.getRawBuffer(), tempBuf);
- normBuf.set(tempBuf.getRawBuffer());
+ const XMLCh* xsNormalized = normBuf.getRawBuffer();
+ DatatypeValidator* tempDV = ((SchemaAttDef*)
attDefForWildCard)->getDatatypeValidator();
+ if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
+ {
+ // normalize the attribute according to schema
whitespace facet
+ XMLBufBid bbtemp(&fBufMgr);
+ XMLBuffer& tempBuf = bbtemp.getBuffer();
+
+ ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, xsNormalized, fWSNormalizeBuf);
+ xsNormalized = fWSNormalizeBuf.getRawBuffer();
+ if (fNormalizeData && fValidate) {
+ normBuf.set(xsNormalized);
}
}
if (fValidate ) {
- fValidator->validateAttrValue
- (
- attDefForWildCard
- , normBuf.getRawBuffer()
- , false
- , elemDecl
+ fValidator->validateAttrValue(
+ attDefForWildCard, xsNormalized, false, elemDecl
);
attrValidator = ((SchemaValidator
*)fValidator)->getMostRecentAttrValidator();
if(((SchemaValidator *)fValidator)->getErrorOccurred())
@@ -2410,46 +2403,40 @@
attrValid = PSVIItem::VALIDITY_INVALID;
}
}
- else // no decl; default DOMTypeInfo to anySimpleType
+ else { // no decl; default DOMTypeInfo to anySimpleType
attrValidator =
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
+ }
// Save the type for later use
attType = attDefForWildCard->getType();
}
else {
- normalizeAttValue
- (
- attDef
- , namePtr
- , curPair->getValue()
- , normBuf
+ normalizeAttValue(
+ attDef, namePtr, curPair->getValue(), normBuf
);
// If we found an attdef for this one, then lets validate
it.
if (attDef)
{
- if (fNormalizeData && (fGrammarType ==
Grammar::SchemaGrammarType))
+ const XMLCh* xsNormalized = normBuf.getRawBuffer();
+ if (fGrammarType == Grammar::SchemaGrammarType)
{
DatatypeValidator* tempDV = ((SchemaAttDef*)
attDef)->getDatatypeValidator();
if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
{
// normalize the attribute according to schema
whitespace facet
- XMLBufBid bbtemp(&fBufMgr);
- XMLBuffer& tempBuf = bbtemp.getBuffer();
-
- ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, normBuf.getRawBuffer(), tempBuf);
- normBuf.set(tempBuf.getRawBuffer());
+ ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, xsNormalized, fWSNormalizeBuf);
+ xsNormalized = fWSNormalizeBuf.getRawBuffer();
+ if (fNormalizeData && fValidate && !skipThisOne)
{
+ normBuf.set(xsNormalized);
+ }
}
}
if (fValidate && !skipThisOne)
{
- fValidator->validateAttrValue
- (
- attDef
- , normBuf.getRawBuffer()
- , false
- , elemDecl
+ fValidator->validateAttrValue(
+ attDef, xsNormalized, false, elemDecl
);
attrValidator = ((SchemaValidator
*)fValidator)->getMostRecentAttrValidator();
if(((SchemaValidator
*)fValidator)->getErrorOccurred())
@@ -2459,11 +2446,13 @@
attrValid = PSVIItem::VALIDITY_INVALID;
}
}
- else
+ else {
attrValidator =
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
+ }
}
- else
+ else {
attrValidator =
DatatypeValidatorFactory::getBuiltInRegistry()->get(SchemaSymbols::fgDT_ANYSIMPLETYPE);
+ }
// Save the type for later use
attType = (attDef)?attDef->getType():XMLAttDef::CData;
@@ -3189,7 +3178,7 @@
if (fValidate)
{
// Get the raw data we need for the callback
- const XMLCh* const rawBuf = toSend.getRawBuffer();
+ const XMLCh* rawBuf = toSend.getRawBuffer();
const unsigned int len = toSend.getLen();
// Get the character data opts for the current element
@@ -3229,35 +3218,37 @@
}
else if (charOpts == XMLElementDecl::AllCharData)
{
- // The normalized data can only be as large as the
- // original size, so this will avoid allocating way
- // too much or too little memory.
- XMLBuffer toFill(len+1, fMemoryManager);
- toFill.set(rawBuf);
-
- if (fNormalizeData)
- {
- DatatypeValidator* tempDV = ((SchemaValidator*)
fValidator)->getCurrentDatatypeValidator();
- if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
- {
- // normalize the character according to schema
whitespace facet
- XMLBufBid bbtemp(&fBufMgr);
- XMLBuffer& tempBuf = bbtemp.getBuffer();
-
- ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, toFill.getRawBuffer(), tempBuf);
- toFill.set(tempBuf.getRawBuffer());
- }
+ unsigned int xsLen;
+ const XMLCh* xsNormalized;
+ DatatypeValidator* tempDV = ((SchemaValidator*)
fValidator)->getCurrentDatatypeValidator();
+ if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
+ {
+ // normalize the character according to schema
whitespace facet
+ ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, rawBuf, fWSNormalizeBuf);
+ xsNormalized = fWSNormalizeBuf.getRawBuffer();
+ xsLen = fWSNormalizeBuf.getLen();
+ }
+ else {
+ xsNormalized = rawBuf;
+ xsLen = len;
}
// tell the schema validation about the character data for
checkContent later
-
((SchemaValidator*)fValidator)->setDatatypeBuffer(toFill.getRawBuffer());
+
((SchemaValidator*)fValidator)->setDatatypeBuffer(xsNormalized);
// call all active identity constraints
- if (toCheckIdentityConstraint() &&
fICHandler->getMatcherCount())
- fContent.append(toFill.getRawBuffer(), toFill.getLen());
+ if (toCheckIdentityConstraint() &&
fICHandler->getMatcherCount()) {
+ fContent.append(xsNormalized, xsLen);
+ }
- if (fDocHandler)
- fDocHandler->docCharacters(toFill.getRawBuffer(),
toFill.getLen(), false);
+ if (fDocHandler) {
+ if (fNormalizeData) {
+ fDocHandler->docCharacters(xsNormalized, xsLen,
false);
+ }
+ else {
+ fDocHandler->docCharacters(rawBuf, len, false);
+ }
+ }
}
}
else
@@ -3267,35 +3258,36 @@
// issue an error.
if (charOpts == XMLElementDecl::AllCharData)
{
- // The normalized data can only be as large as the
- // original size, so this will avoid allocating way
- // too much or too little memory.
- XMLBuffer toFill(len+1, fMemoryManager);
- toFill.set(rawBuf);
-
- if (fNormalizeData)
- {
- DatatypeValidator* tempDV = ((SchemaValidator*)
fValidator)->getCurrentDatatypeValidator();
- if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
- {
- // normalize the character according to schema
whitespace facet
- XMLBufBid bbtemp(&fBufMgr);
- XMLBuffer& tempBuf = bbtemp.getBuffer();
-
- ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, toFill.getRawBuffer(), tempBuf);
- toFill.set(tempBuf.getRawBuffer());
- }
+ unsigned int xsLen;
+ const XMLCh *xsNormalized;
+ DatatypeValidator* tempDV = ((SchemaValidator*)
fValidator)->getCurrentDatatypeValidator();
+ if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
+ {
+ ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, rawBuf, fWSNormalizeBuf);
+ xsNormalized = fWSNormalizeBuf.getRawBuffer();
+ xsLen = fWSNormalizeBuf.getLen();
+ }
+ else {
+ xsNormalized = rawBuf;
+ xsLen = len;
}
// tell the schema validation about the character data for
checkContent later
-
((SchemaValidator*)fValidator)->setDatatypeBuffer(toFill.getRawBuffer());
+
((SchemaValidator*)fValidator)->setDatatypeBuffer(xsNormalized);
// call all active identity constraints
- if (toCheckIdentityConstraint() &&
fICHandler->getMatcherCount())
- fContent.append(toFill.getRawBuffer(), toFill.getLen());
+ if (toCheckIdentityConstraint() &&
fICHandler->getMatcherCount()) {
+ fContent.append(xsNormalized, xsLen);
+ }
- if (fDocHandler)
- fDocHandler->docCharacters(toFill.getRawBuffer(),
toFill.getLen(), false);
+ if (fDocHandler) {
+ if (fNormalizeData) {
+ fDocHandler->docCharacters(xsNormalized, xsLen,
false);
+ }
+ else {
+ fDocHandler->docCharacters(rawBuf, len, false);
+ }
+ }
}
else
{
@@ -4059,27 +4051,25 @@
if (nextCh == chCloseSquare && fReaderMgr.skippedString(CDataClose))
{
// make sure we were not expecting a trailing surrogate.
- if (gotLeadingSurrogate)
+ if (gotLeadingSurrogate) {
emitError(XMLErrs::Expected2ndSurrogateChar);
+ }
+ unsigned int xsLen = bbCData.getLen();
+ const XMLCh* xsNormalized = bbCData.getRawBuffer();
if (fValidate) {
- if (fNormalizeData)
+ DatatypeValidator* tempDV = ((SchemaValidator*)
fValidator)->getCurrentDatatypeValidator();
+ if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
{
- DatatypeValidator* tempDV = ((SchemaValidator*)
fValidator)->getCurrentDatatypeValidator();
- if (tempDV && tempDV->getWSFacet() !=
DatatypeValidator::PRESERVE)
- {
- // normalize the character according to schema
whitespace facet
- XMLBufBid bbtemp(&fBufMgr);
- XMLBuffer& tempBuf = bbtemp.getBuffer();
-
- ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, bbCData.getRawBuffer(), tempBuf);
- bbCData.set(tempBuf.getRawBuffer());
- }
+ // normalize the character according to schema
whitespace facet
+ ((SchemaValidator*)
fValidator)->normalizeWhiteSpace(tempDV, xsNormalized, fWSNormalizeBuf);
+ xsNormalized = fWSNormalizeBuf.getRawBuffer();
+ xsLen = fWSNormalizeBuf.getLen();
}
// tell the schema validation about the character data for
checkContent later
-
((SchemaValidator*)fValidator)->setDatatypeBuffer(bbCData.getRawBuffer());
+
((SchemaValidator*)fValidator)->setDatatypeBuffer(xsNormalized);
if (charOpts != XMLElementDecl::AllCharData)
{
@@ -4094,18 +4084,21 @@
}
// call all active identity constraints
- if (toCheckIdentityConstraint() && fICHandler->getMatcherCount())
- fContent.append(bbCData.getRawBuffer(), bbCData.getLen());
+ if (toCheckIdentityConstraint() &&
fICHandler->getMatcherCount()) {
+ fContent.append(xsNormalized, xsLen);
+ }
// If we have a doc handler, call it
if (fDocHandler)
{
- fDocHandler->docCharacters
- (
- bbCData.getRawBuffer()
- , bbCData.getLen()
- , true
+ if (fNormalizeData) {
+ fDocHandler->docCharacters(xsNormalized, xsLen, true);
+ }
+ else {
+ fDocHandler->docCharacters(
+ bbCData.getRawBuffer(), bbCData.getLen(), true
);
+ }
}
// And we are done
1.77 +3 -1 xml-xerces/c/src/xercesc/internal/XMLScanner.cpp
Index: XMLScanner.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLScanner.cpp,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -r1.76 -r1.77
--- XMLScanner.cpp 7 Dec 2004 19:45:43 -0000 1.76
+++ XMLScanner.cpp 9 Dec 2004 20:31:39 -0000 1.77
@@ -206,6 +206,7 @@
, fQNameBuf(1023, manager)
, fPrefixBuf(1023, manager)
, fURIBuf(1023, manager)
+ , fWSNormalizeBuf(1023, manager)
, fElemStack(manager)
{
commonInit();
@@ -290,6 +291,7 @@
, fQNameBuf(1023, manager)
, fPrefixBuf(1023, manager)
, fURIBuf(1023, manager)
+ , fWSNormalizeBuf(1023, manager)
, fElemStack(manager)
{
commonInit();
1.46 +5 -0 xml-xerces/c/src/xercesc/internal/XMLScanner.hpp
Index: XMLScanner.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLScanner.hpp,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- XMLScanner.hpp 7 Dec 2004 19:45:43 -0000 1.45
+++ XMLScanner.hpp 9 Dec 2004 20:31:39 -0000 1.46
@@ -16,6 +16,10 @@
/*
* $Log$
+ * Revision 1.46 2004/12/09 20:31:39 knoaman
+ * DOM L3: pass schema normalized value only when datatype-normalization
feature
+ * is enabled.
+ *
* Revision 1.45 2004/12/07 19:45:43 knoaman
* An option to ignore a cached DTD grammar when a document contains an
* internal and external subset.
@@ -1062,6 +1066,7 @@
XMLBuffer fQNameBuf;
XMLBuffer fPrefixBuf;
XMLBuffer fURIBuf;
+ XMLBuffer fWSNormalizeBuf;
ElemStack fElemStack;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]