XmlDocument Class Reference

#include <XmlDocument.h>

Inherits Support.

Inheritance diagram for XmlDocument:

Inheritance graph
[legend]
Collaboration diagram for XmlDocument:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 XmlDocument ()
virtual ~XmlDocument ()
int reset ()
int parse (const char *data, const unsigned int size, const bool isFinal=true)
int createElement (const String &tag, XmlElement **element, XmlAttribute *attr=NULL)
int removeElement (XmlElement *element)
XmlElementroot () const
int getElementById (const String &id, XmlElement **element) const
int getElementsByName (const String &name, XmlElementCollection &elements) const
int getElementsByTagName (const String &tag, XmlElementCollection &elements) const

Static Private Member Functions

static void XMLCALL start (void *document, const char *tag, const char **attrs)
static void XMLCALL end (void *document, const char *tag)
static void XMLCALL data (void *document, const XML_Char *str, int len)
static int _getElementById (const String &id, XmlElement **element, bool &found)
static int _getElementsByName (const String &name, XmlElement *element, XmlElementCollection &elements)
static int _getElementsByTagName (const String &tag, XmlElement *element, XmlElementCollection &elements)

Private Attributes

XML_Parser _parser
XmlElement_root
XmlElement_current

Detailed Description

Definition at line 37 of file XmlDocument.h.


Constructor & Destructor Documentation

XmlDocument::XmlDocument (  ) 

Definition at line 16 of file XmlDocument.cpp.

References _parser, data(), end(), ERROR, Support::failure(), MSG_XML_DOCUMENT_PARSER_CANNOT_CREATE, and start().

XmlDocument::~XmlDocument (  )  [virtual]

Definition at line 31 of file XmlDocument.cpp.

References _parser.


Member Function Documentation

int XmlDocument::reset (  ) 

Definition at line 36 of file XmlDocument.cpp.

References _parser, ERROR, MSG_XML_DOCUMENT_PARSER_CANNOT_RESET, and OK.

Referenced by Config::Config().

int XmlDocument::parse ( const char *  data,
const unsigned int  size,
const bool  isFinal = true 
)

Definition at line 44 of file XmlDocument.cpp.

References _parser, ERROR, MSG_XML_DOCUMENT_PARSER, and OK.

Referenced by Config::Config().

int XmlDocument::createElement ( const String tag,
XmlElement **  element,
XmlAttribute attr = NULL 
)

Definition at line 53 of file XmlDocument.cpp.

References CHECK_POINTER, String::equals(), ERROR, ERROR_BACKTRACE(), FAILED(), MSG_OBJECT_CANNOT_CREATE, OK, XML_ATTR_TAGS, XML_TAG_DATA, and XML_TAG_REGISTRY.

Referenced by Config::set(), and start().

int XmlDocument::removeElement ( XmlElement element  ) 

Definition at line 93 of file XmlDocument.cpp.

References CHECK_POINTER, ERROR_BACKTRACE(), FAILED(), OK, XmlElement::parent(), and XmlElement::removeChild().

Referenced by Config::remove().

XmlElement * XmlDocument::root (  )  const

Definition at line 108 of file XmlDocument.cpp.

References _root.

Referenced by Config::save().

int XmlDocument::getElementById ( const String id,
XmlElement **  element 
) const

Definition at line 113 of file XmlDocument.cpp.

References _getElementById(), _root, CSTRING(), ERROR, ERROR_BACKTRACE(), FAILED(), MSG_NULL_POINTER, MSG_XML_DOCUMENT_ELEMENT_NOT_FOUND, MSG_XML_DOCUMENT_EMPTY, OK, and WARNING.

Referenced by Config::get(), Config::remove(), and Config::set().

int XmlDocument::getElementsByName ( const String name,
XmlElementCollection elements 
) const

Definition at line 136 of file XmlDocument.cpp.

References _getElementsByName(), _root, ERROR_BACKTRACE(), FAILED(), MSG_XML_DOCUMENT_EMPTY, OK, and WARNING.

int XmlDocument::getElementsByTagName ( const String tag,
XmlElementCollection elements 
) const

Definition at line 154 of file XmlDocument.cpp.

References _getElementsByTagName(), _root, ERROR_BACKTRACE(), FAILED(), MSG_XML_DOCUMENT_EMPTY, OK, and WARNING.

void XMLCALL XmlDocument::start ( void *  document,
const char *  tag,
const char **  attrs 
) [static, private]

Definition at line 174 of file XmlDocument.cpp.

References _current, _root, XmlElement::appendChild(), createElement(), ERROR, ERROR_BACKTRACE(), FAILED(), MSG_OBJECT_CANNOT_CREATE, and XmlAttribute::setNext().

Referenced by XmlDocument().

void XMLCALL XmlDocument::end ( void *  document,
const char *  tag 
) [static, private]

Definition at line 222 of file XmlDocument.cpp.

References _current, XmlElement::close(), DEBUG, ERROR_BACKTRACE(), FAILED(), and XmlElement::parent().

Referenced by XmlDocument().

void XMLCALL XmlDocument::data ( void *  document,
const XML_Char *  str,
int  len 
) [static, private]

Definition at line 239 of file XmlDocument.cpp.

References _current, XmlElement::appendInnerData(), ERROR_BACKTRACE(), and FAILED().

Referenced by XmlDocument().

int XmlDocument::_getElementById ( const String id,
XmlElement **  element,
bool found 
) [static, private]

Definition at line 254 of file XmlDocument.cpp.

References ERROR, ERROR_BACKTRACE(), FAILED(), MSG_NULL_POINTER, and OK.

Referenced by getElementById().

int XmlDocument::_getElementsByName ( const String name,
XmlElement element,
XmlElementCollection elements 
) [static, private]

Definition at line 286 of file XmlDocument.cpp.

References XmlElement::_children, String::equals(), ERROR, ERROR_BACKTRACE(), FAILED(), XmlElement::hasChildren(), MSG_NULL_POINTER, XmlElement::name(), and OK.

Referenced by _getElementsByTagName(), and getElementsByName().

int XmlDocument::_getElementsByTagName ( const String tag,
XmlElement element,
XmlElementCollection elements 
) [static, private]

Definition at line 311 of file XmlDocument.cpp.

References XmlElement::_children, _getElementsByName(), String::equals(), ERROR, ERROR_BACKTRACE(), FAILED(), XmlElement::hasChildren(), MSG_NULL_POINTER, OK, and XmlElement::tag().

Referenced by getElementsByTagName().


Member Data Documentation

XML_Parser XmlDocument::_parser [private]

Definition at line 67 of file XmlDocument.h.

Referenced by parse(), reset(), XmlDocument(), and ~XmlDocument().

XmlElement* XmlDocument::_root [private]

Definition at line 68 of file XmlDocument.h.

Referenced by getElementById(), getElementsByName(), getElementsByTagName(), root(), and start().

XmlElement* XmlDocument::_current [private]

Definition at line 69 of file XmlDocument.h.

Referenced by data(), end(), and start().


The documentation for this class was generated from the following files:
Generated on Thu Sep 6 20:14:15 2007 for Pylon Application Platform by  doxygen 1.5.1