libxml++ r174 - in trunk: . libxml++/parsers
- From: arminb svn gnome org
- To: svn-commits-list gnome org
- Subject: libxml++ r174 - in trunk: . libxml++/parsers
- Date: Mon, 14 Apr 2008 12:42:52 +0100 (BST)
Author: arminb
Date: Mon Apr 14 12:42:52 2008
New Revision: 174
URL: http://svn.gnome.org/viewvc/libxml++?rev=174&view=rev
Log:
2008-04-14 Armin Burgmeier <armin arbur net>
* libxml++/parsers/saxparser.h:
* libxml++/parsers/saxparser.cc: Added a parse_chunk_raw() method and
changed parse_chunk() to use it.
Modified:
trunk/ChangeLog
trunk/libxml++/parsers/saxparser.cc
trunk/libxml++/parsers/saxparser.h
Modified: trunk/libxml++/parsers/saxparser.cc
==============================================================================
--- trunk/libxml++/parsers/saxparser.cc (original)
+++ trunk/libxml++/parsers/saxparser.cc Mon Apr 14 12:42:52 2008
@@ -256,6 +256,11 @@
void SaxParser::parse_chunk(const Glib::ustring& chunk)
{
+ parse_chunk_raw((const unsigned char*)chunk.c_str(), chunk.bytes());
+}
+
+void SaxParser::parse_chunk_raw(const unsigned char* contents, size_type bytes_count)
+{
KeepBlanks k(KeepBlanks::Default);
if(!context_)
@@ -271,12 +276,11 @@
}
if(!exception_)
- xmlParseChunk(context_, chunk.c_str(), chunk.bytes(), 0 /* don't terminate */);
+ xmlParseChunk(context_, (const char*)contents, bytes_count, 0 /* don't terminate */);
check_for_exception();
}
-
void SaxParser::release_underlying()
{
Parser::release_underlying();
Modified: trunk/libxml++/parsers/saxparser.h
==============================================================================
--- trunk/libxml++/parsers/saxparser.h (original)
+++ trunk/libxml++/parsers/saxparser.h Mon Apr 14 12:42:52 2008
@@ -119,6 +119,23 @@
*/
virtual void parse_chunk(const Glib::ustring& chunk);
+ /** Parse a chunk of data.
+ *
+ * @newin2p24
+ *
+ * This lets you pass a document in small chunks, e.g. from a network
+ * connection. The on_* virtual functions are called each time the chunks
+ * provide enough information to advance the parser.
+ *
+ * The first call to parse_chunk will setup the parser. When the last chunk
+ * has been parsed, call finish_chunk_parsing() to finish the parse.
+ *
+ * @throw exception
+ * @param contents The next piece of the XML document as an array of bytes.
+ * @param bytes_count The number of bytes in the @a contents array.
+ */
+ void parse_chunk_raw(const unsigned char* contents, size_type bytes_count);
+
/** Finish a chunk-wise parse.
*
* Call this after the last call to parse_chunk(). Don't use this function with
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]