neilg 2003/12/03 12:00:27
Modified: c/src/xercesc/validators/schema SchemaValidator.cpp
SchemaValidator.hpp
c/src/xercesc/internal IGXMLScanner.cpp SGXMLScanner.cpp
Log:
PSVI fix: cannot allow validator to reset its element content buffer before
exposing it to the application
Revision Changes Path
1.47 +6 -2 xml-xerces/c/src/xercesc/validators/schema/SchemaValidator.cpp
Index: SchemaValidator.cpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/SchemaValidator.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- SchemaValidator.cpp 27 Nov 2003 22:52:37 -0000 1.46
+++ SchemaValidator.cpp 3 Dec 2003 20:00:27 -0000 1.47
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.47 2003/12/03 20:00:27 neilg
+ * PSVI fix: cannot allow validator to reset its element content buffer before
exposing it to the application
+ *
* Revision 1.46 2003/11/27 22:52:37 knoaman
* PSVIElement implementation
*
@@ -541,7 +544,8 @@
ThrowXML(RuntimeException, XMLExcepts::CM_UnknownCMType);
}
- fDatatypeBuffer.reset();
+ // must rely on scanner to clear fDatatypeBuffer
+ // since it may need to query its contents after this method completes
fNil = false;
fTrailing=false;
1.24 +10 -1 xml-xerces/c/src/xercesc/validators/schema/SchemaValidator.hpp
Index: SchemaValidator.hpp
===================================================================
RCS file: /home/cvs/xml-xerces/c/src/xercesc/validators/schema/SchemaValidator.hpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- SchemaValidator.hpp 28 Nov 2003 21:18:32 -0000 1.23
+++ SchemaValidator.hpp 3 Dec 2003 20:00:27 -0000 1.24
@@ -56,6 +56,9 @@
/*
* $Log$
+ * Revision 1.24 2003/12/03 20:00:27 neilg
+ * PSVI fix: cannot allow validator to reset its element content buffer before
exposing it to the application
+ *
* Revision 1.23 2003/11/28 21:18:32 knoaman
* Make use of canonical representation in PSVIElement
*
@@ -266,6 +269,7 @@
void setErrorReporter(XMLErrorReporter* const errorReporter);
void setExitOnFirstFatal(const bool newValue);
void setDatatypeBuffer(const XMLCh* const value);
+ void clearDatatypeBuffer();
// -----------------------------------------------------------------------
// Getter methods
@@ -459,6 +463,11 @@
inline void SchemaValidator::setDatatypeBuffer(const XMLCh* const value)
{
fDatatypeBuffer.append(value);
+}
+
+inline void SchemaValidator::clearDatatypeBuffer()
+{
+ fDatatypeBuffer.reset();
}
// ---------------------------------------------------------------------------
1.43 +3 -0 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.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- IGXMLScanner.cpp 3 Dec 2003 17:29:43 -0000 1.42
+++ IGXMLScanner.cpp 3 Dec 2003 20:00:27 -0000 1.43
@@ -1194,6 +1194,9 @@
endElementPSVI(
(SchemaElementDecl*)topElem->fThisElement, psviMemberType);
}
+ // now we can reset the datatype buffer, since the
+ // application has had a chance to copy the characters somewhere else
+ ((SchemaValidator *)fValidator)->clearDatatypeBuffer();
}
// If we have a doc handler, tell it about the end tag
1.62 +3 -0 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.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- SGXMLScanner.cpp 3 Dec 2003 17:29:44 -0000 1.61
+++ SGXMLScanner.cpp 3 Dec 2003 20:00:27 -0000 1.62
@@ -1102,6 +1102,9 @@
(SchemaElementDecl*)topElem->fThisElement, psviMemberType
);
}
+ // now we can reset the datatype buffer, since the
+ // application has had a chance to copy the characters somewhere else
+ ((SchemaValidator *)fValidator)->clearDatatypeBuffer();
// If we have a doc handler, tell it about the end tag
if (fDocHandler)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]