HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_XMLSaxParser Class Reference

#include <UT_XMLSaxParser.h>

+ Inheritance diagram for UT_XMLSaxParser:

Public Types

typedef UT_Array
< UT_XMLAttribute * > 
UT_XMLAttributeList
 A list of XML element attributes. More...
 

Public Member Functions

 UT_XMLSaxParser ()
 Standard constructor. More...
 
 ~UT_XMLSaxParser () override
 Standard destructor. More...
 
bool parseFileUTF8 (const char *filename)
 
virtual void onStartDocument ()
 
virtual void onEndDocument ()
 
virtual void onStartElement (const UT_String &name, const UT_XMLAttributeList &attribs)
 
virtual void onEndElement (const UT_String &name)
 
virtual void onCharacters (const UT_String &characters)
 
virtual void onCDATABlock (const UT_String &characters)
 
virtual void onComment (const UT_String &text)
 
virtual void onWarning (const UT_String &text)
 
virtual void onError (const UT_String &text)
 
virtual void onFatalError (const UT_String &text)
 
bool parseContextSubclass () override
 
- Public Member Functions inherited from UT_XMLParser
 UT_XMLParser ()
 Standard constructor. More...
 
virtual ~UT_XMLParser ()
 Standard destructor. More...
 
void setSubstituteEntities (bool substitute)
 
bool parseMemory (const char *contents, int size=-1)
 
bool parseFile (const char *filename)
 
bool parseFile (const char *filename, bool handle_missing_file)
 
const char * getError () const
 

Static Public Member Functions

static bool getAttribute (const UT_XMLAttributeList &attribs, const char *name, UT_String &value)
 Utility method for getting the value of an attribute. More...
 
static UT_String getStringAttribute (const UT_XMLAttributeList &attribs, const char *name)
 
static bool hasAttribute (const UT_XMLAttributeList &attribs, const char *name)
 
static int getIntegerAttribute (const UT_XMLAttributeList &attribs, const char *name)
 
static double getDoubleAttribute (const UT_XMLAttributeList &attribs, const char *name, double defValue)
 

Protected Types

typedef std::pair< UT_String,
UT_String > 
UT_XMLAttribute
 An XML element attribute as defined by a name and a value. More...
 

Friends

class utSaxParserCallback
 

Additional Inherited Members

- Protected Member Functions inherited from UT_XMLParser
bool parseContext ()
 
xmlParserCtxtPtr getContext () const
 Return the current parsing context. More...
 
void setError (const char *error)
 Sets the error message for the current parsing run. More...
 

Detailed Description

Definition at line 29 of file UT_XMLSaxParser.h.

Member Typedef Documentation

typedef std::pair<UT_String, UT_String> UT_XMLSaxParser::UT_XMLAttribute
protected

An XML element attribute as defined by a name and a value.

Definition at line 48 of file UT_XMLSaxParser.h.

A list of XML element attributes.

Definition at line 52 of file UT_XMLSaxParser.h.

Constructor & Destructor Documentation

UT_XMLSaxParser::UT_XMLSaxParser ( )

Standard constructor.

UT_XMLSaxParser::~UT_XMLSaxParser ( )
override

Standard destructor.

Member Function Documentation

static bool UT_XMLSaxParser::getAttribute ( const UT_XMLAttributeList &  attribs,
const char *  name,
UT_String &  value 
)
static

Utility method for getting the value of an attribute.

static double UT_XMLSaxParser::getDoubleAttribute ( const UT_XMLAttributeList &  attribs,
const char *  name,
double  defValue 
)
inlinestatic

Definition at line 103 of file UT_XMLSaxParser.h.

static int UT_XMLSaxParser::getIntegerAttribute ( const UT_XMLAttributeList &  attribs,
const char *  name 
)
inlinestatic

Definition at line 94 of file UT_XMLSaxParser.h.

static UT_String UT_XMLSaxParser::getStringAttribute ( const UT_XMLAttributeList &  attribs,
const char *  name 
)
inlinestatic

Definition at line 77 of file UT_XMLSaxParser.h.

static bool UT_XMLSaxParser::hasAttribute ( const UT_XMLAttributeList &  attribs,
const char *  name 
)
inlinestatic

Definition at line 86 of file UT_XMLSaxParser.h.

virtual void UT_XMLSaxParser::onCDATABlock ( const UT_String &  characters)
virtual
virtual void UT_XMLSaxParser::onCharacters ( const UT_String &  characters)
virtual
virtual void UT_XMLSaxParser::onComment ( const UT_String &  text)
virtual
virtual void UT_XMLSaxParser::onEndDocument ( )
virtual
virtual void UT_XMLSaxParser::onEndElement ( const UT_String &  name)
virtual
virtual void UT_XMLSaxParser::onError ( const UT_String &  text)
virtual
virtual void UT_XMLSaxParser::onFatalError ( const UT_String &  text)
virtual
virtual void UT_XMLSaxParser::onStartDocument ( )
virtual

Callback methods that are called at various times of the parse.

virtual void UT_XMLSaxParser::onStartElement ( const UT_String &  name,
const UT_XMLAttributeList &  attribs 
)
virtual
virtual void UT_XMLSaxParser::onWarning ( const UT_String &  text)
virtual
bool UT_XMLSaxParser::parseContextSubclass ( )
overridevirtual

Parse XML using the current context. Return true on a successful parse. Return false otherwise.

Implements UT_XMLParser.

bool UT_XMLSaxParser::parseFileUTF8 ( const char *  filename)

Parse a file, handing the callbacks below libxml2's UTF-8 unchanged. parseFile() instead converts to Latin-1, which silently drops every code point above U+00FF; that remains the default so existing subclasses are unaffected. Use this one if your consumers are UTF-8 clean. Returns true on a successful parse.

Friends And Related Function Documentation

friend class utSaxParserCallback
friend

We need to give the callback helper class access to the parser's callback functions (i.e. onStartElement).

Definition at line 118 of file UT_XMLSaxParser.h.


The documentation for this class was generated from the following file: