peiyongz 2004/09/29 12:00:02
Modified: c/src/xercesc/internal XMLScanner.hpp XMLScanner.cpp
Log:
[jira1207] --patch from Dan Rosen
Revision Changes Path
1.41 +26 -1 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.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- XMLScanner.hpp 28 Sep 2004 21:27:38 -0000 1.40
+++ XMLScanner.hpp 29 Sep 2004 19:00:02 -0000 1.41
@@ -16,6 +16,9 @@
/*
* $Log$
+ * Revision 1.41 2004/09/29 19:00:02 peiyongz
+ * [jira1207] --patch from Dan Rosen
+ *
* Revision 1.40 2004/09/28 21:27:38 peiyongz
* Optimized duplicated attributes checking for large number of attributes
*
@@ -332,7 +335,7 @@
// This is the mondo scanner class, which does the vast majority of the
// work of parsing. It handles reading in input and spitting out events
// to installed handlers.
-class XMLPARSER_EXPORT XMLScanner : public XMemory
+class XMLPARSER_EXPORT XMLScanner : public XMemory, public XMLBufferFullHandler
{
public :
// -----------------------------------------------------------------------
@@ -436,6 +439,16 @@
);
// -----------------------------------------------------------------------
+ // Implementation of XMLBufferFullHandler interface
+ // -----------------------------------------------------------------------
+
+ virtual bool bufferFull(XMLBuffer& toSend)
+ {
+ sendCharData(toSend);
+ return true;
+ }
+
+ // -----------------------------------------------------------------------
// Public pure virtual methods
// -----------------------------------------------------------------------
virtual const XMLCh* getName() const = 0;
@@ -617,6 +630,7 @@
void setCalculateSrcOfs(const bool newValue);
void setParseSettings(XMLScanner* const refScanner);
void setStandardUriConformant(const bool newValue);
+ void setInputBufferSize(const size_t bufferSize);
void setGenerateSyntheticAnnotations(const bool newValue);
void setValidateAnnotations(const bool newValue);
@@ -744,6 +758,9 @@
// -----------------------------------------------------------------------
// Data members
//
+ // fBufferSize
+ // Maximum input buffer size
+ //
// fAttrList
// Every time we get a new element start tag, we have to pass to
// the document handler the attributes found. To make it more
@@ -961,7 +978,9 @@
//
// fMemoryManager
// Pluggable memory manager for dynamic allocation/deallocation.
+ //
// -----------------------------------------------------------------------
+ size_t fBufferSize;
bool fStandardUriConformant;
bool fCalculateSrcOfs;
bool fDoNamespaces;
@@ -1498,6 +1517,12 @@
inline void XMLScanner::setValidateAnnotations(const bool newValue)
{
fValidateAnnotations = newValue;
+}
+
+inline void XMLScanner::setInputBufferSize(const size_t bufferSize)
+{
+ fBufferSize = bufferSize;
+ fCDataBuf.setFullHandler(this, fBufferSize);
}
// ---------------------------------------------------------------------------
1.72 +6 -2 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.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- XMLScanner.cpp 28 Sep 2004 21:27:38 -0000 1.71
+++ XMLScanner.cpp 29 Sep 2004 19:00:02 -0000 1.72
@@ -123,7 +123,8 @@
XMLScanner::XMLScanner(XMLValidator* const valToAdopt,
GrammarResolver* const grammarResolver,
MemoryManager* const manager)
- : fStandardUriConformant(false)
+ : fBufferSize(1024 * 1024)
+ , fStandardUriConformant(false)
, fCalculateSrcOfs(false)
, fDoNamespaces(false)
, fExitOnFirstFatal(true)
@@ -714,6 +715,9 @@
fUIntPool[0] = (unsigned int *)fMemoryManager->allocate(sizeof(unsigned int) <<
6);
memset(fUIntPool[0], 0, sizeof(unsigned int) << 6);
fUIntPool[1] = 0;
+
+ // Register self as handler for XMLBufferFull events on the CDATA buffer
+ fCDataBuf.setFullHandler(this, fBufferSize);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]