XML streaming parser.
More...
#include <xml.h>
|
virtual void | characters (caddr_t text, size_t size) |
| Virtual to receive character text extracted from the document. More...
|
|
virtual void | comment (caddr_t text, size_t size) |
| Virtual to receive embedded comments in XML document being parsed. More...
|
|
bool | end (void) const |
| End of document check. More...
|
|
virtual void | endDocument (void) |
| Notify end of document event.
|
|
virtual void | endElement (caddr_t name)=0 |
| Notify end of an element in the document. More...
|
|
bool | parse (CharacterProtocol &stream) |
| Parse a stream buffer and return parser document completion flag. More...
|
|
bool | parse (FILE *file) |
| Parse a file buffer and return parser document completion flag. More...
|
|
bool | partial (const char *address, size_t size) |
| Parse a chunk of data and return parser completion flag. More...
|
|
virtual void | startDocument (void) |
| Notify start of document event.
|
|
virtual void | startElement (caddr_t name, caddr_t *attr)=0 |
| Notify start of an element in the document. More...
|
|
| XMLParser (unsigned size=8192) |
| Create xml parser. More...
|
|
virtual | ~XMLParser () |
| Destroy xml parser.
|
|
XML streaming parser.
This class implements a basic XML stream parser that can be used to examine an XML resource thru virtual I/O methods. This class must be derived into one that can implement the physical I/O required to parse actual data. A mixer class using XMLParser and tcpstream would be one example of this. This can also be used to parse xml content in memory buffers easily. This parser is only concerned with well-formedness, and does not perform validation.
- Author
- David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org
Definition at line 48 of file xml.h.
ucommon::XMLParser::XMLParser |
( |
unsigned |
size = 8192 | ) |
|
|
protected |
Create xml parser.
- Parameters
-
virtual void ucommon::XMLParser::characters |
( |
caddr_t |
text, |
|
|
size_t |
size |
|
) |
| |
|
protectedvirtual |
Virtual to receive character text extracted from the document.
- Parameters
-
text | received. |
size | of text received. |
virtual void ucommon::XMLParser::comment |
( |
caddr_t |
text, |
|
|
size_t |
size |
|
) |
| |
|
protectedvirtual |
Virtual to receive embedded comments in XML document being parsed.
- Parameters
-
text | received. |
size | of text received. |
bool ucommon::XMLParser::end |
( |
void |
| ) |
const |
|
inlineprotected |
End of document check.
- Returns
- true if end of document.
Definition at line 147 of file xml.h.
virtual void ucommon::XMLParser::endElement |
( |
caddr_t |
name | ) |
|
|
protectedpure virtual |
Notify end of an element in the document.
- Parameters
-
Parse a stream buffer and return parser document completion flag.
This is used to scan a stream buffer for a complete XML document. The stream is scanned until the document is complete or EOF. Multiple XML document instances can be scanned from a continues XML streaming source.
- Parameters
-
- Returns
- true if parse complete, false if invalid or EOF.
bool ucommon::XMLParser::parse |
( |
FILE * |
file | ) |
|
|
protected |
Parse a file buffer and return parser document completion flag.
This is used to scan a file buffer for a complete XML document. The file is scanned until the document is complete or EOF. Multiple XML document instances can be scanned from a continues XML streaming source.
- Parameters
-
- Returns
- true if parse complete, false if invalid or EOF.
bool ucommon::XMLParser::partial |
( |
const char * |
address, |
|
|
size_t |
size |
|
) |
| |
|
protected |
Parse a chunk of data and return parser completion flag.
This is used to externally drive data into the XML parser. The return status can be used to determine when a document has been fully parsed. This can be called multiple times to push stream data into the parser.
- Parameters
-
address | of data to parse. |
size | of data to parse. |
virtual void ucommon::XMLParser::startElement |
( |
caddr_t |
name, |
|
|
caddr_t * |
attr |
|
) |
| |
|
protectedpure virtual |
Notify start of an element in the document.
- Parameters
-
name | of element found. |
attr | list of attributes extracted. |
The documentation for this class was generated from the following file: