Yate
Public Member Functions | Protected Member Functions | Friends | List of all members
XmlDomParser Class Reference

Document Object Model XML Parser. More...

#include <yatexml.h>

Inheritance diagram for XmlDomParser:
XmlSaxParser DebugEnabler

Public Member Functions

 XmlDomParser (const char *name="XmlDomParser", bool fragment=false)
 
 XmlDomParser (XmlParent *fragment, bool takeOwnership)
 
virtual ~XmlDomParser ()
 
XmlDocumentdocument ()
 
XmlFragmentfragment ()
 
virtual void reset ()
 
bool isCurrent (const XmlElement *el) const
 
- Public Member Functions inherited from XmlSaxParser
virtual ~XmlSaxParser ()
 
unsigned int offset () const
 
unsigned int row () const
 
unsigned int column () const
 
const Stringbuffer () const
 
bool parse (const char *data)
 
bool completeText ()
 
Error error ()
 
bool setError (Error error, XmlChild *child=0)
 
const char * getError (const char *defVal="Xml error")
 
Type unparsed ()
 
void setUnparsed (Type id)
 
const StringgetBuffer () const
 
- Public Member Functions inherited from DebugEnabler
 DebugEnabler (int level=TelEngine::debugLevel(), bool enabled=true)
 
int debugLevel () const
 
int debugLevel (int level)
 
bool debugEnabled () const
 
void debugEnabled (bool enable)
 
const char * debugName () const
 
bool debugAt (int level) const
 
bool debugChained () const
 
void debugChain (const DebugEnabler *chain=0)
 
void debugCopy (const DebugEnabler *original=0)
 

Protected Member Functions

virtual void gotComment (const String &text)
 
virtual void gotProcessing (const NamedString &instr)
 
virtual void gotDeclaration (const NamedList &decl)
 
virtual void gotText (const String &text)
 
virtual void gotCdata (const String &data)
 
virtual void gotElement (const NamedList &element, bool empty)
 
virtual void endElement (const String &name)
 
virtual void gotDoctype (const String &doc)
 
virtual bool completed ()
 
- Protected Member Functions inherited from XmlSaxParser
 XmlSaxParser (const char *name="XmlSaxParser")
 
bool parseInstruction ()
 
bool parseCData ()
 
bool parseComment ()
 
bool parseElement ()
 
bool parseDeclaration ()
 
bool parseSpecial ()
 
bool parseEndTag ()
 
bool parseDoctype ()
 
bool auxParse ()
 
void unEscape (String &text)
 
void skipBlanks ()
 
bool badCharacter (char c)
 
void resetError ()
 
void resetParsed ()
 
StringextractName (bool &empty)
 
NamedStringgetAttribute ()
 
bool processElement (NamedList &list, bool empty)
 
bool processText (String &text)
 
- Protected Member Functions inherited from DebugEnabler
void debugName (const char *name)
 

Friends

class XmlChild
 

Additional Inherited Members

- Public Types inherited from XmlSaxParser
enum  Error {
  NoError = 0, NotWellFormed, Unknown, IOError,
  ElementParse, ReadElementName, InvalidElementName, ReadingAttributes,
  CommentParse, DeclarationParse, DefinitionParse, CDataParse,
  ReadingEndTag, Incomplete, InvalidEncoding, UnsupportedEncoding,
  UnsupportedVersion
}
 
enum  Type {
  None = 0, Text = 1, CData = 2, Element = 3,
  Doctype = 4, Comment = 5, Declaration = 6, Instruction = 7,
  EndTag = 8, Special = 9
}
 
- Static Public Member Functions inherited from XmlSaxParser
static const char * getError (int code, const char *defVal="Xml error")
 
static bool blank (char c)
 
static bool checkFirstNameCharacter (unsigned char ch)
 
static bool checkDataChar (unsigned char c)
 
static bool checkNameCharacter (unsigned char ch)
 
static bool validTag (const String &buf)
 
static void escape (String &buf, const String &text)
 
- Static Public Attributes inherited from XmlSaxParser
static const TokenDict s_errorString []
 
static const XmlEscape s_escape []
 
- Protected Attributes inherited from XmlSaxParser
unsigned int m_offset
 
unsigned int m_row
 
unsigned int m_column
 
Error m_error
 
String m_buf
 
NamedList m_parsed
 
Type m_unparsed
 

Detailed Description

Document Object Model XML Parser.

A Document Object Model (DOM) parser for XML documents and fragments

Constructor & Destructor Documentation

XmlDomParser ( const char *  name = "XmlDomParser",
bool  fragment = false 
)

XmlDomParser constructor

Parameters
nameDebug name
fragmentTrue if this parser needs to parse a piece of a xml document
XmlDomParser ( XmlParent fragment,
bool  takeOwnership 
)

XmlDomParser constructor

Parameters
fragmentThe fragment who should keep the parsed data
takeOwnershipTrue to take ownership of the fragment
virtual ~XmlDomParser ( )
virtual

Destructor

Member Function Documentation

virtual bool completed ( )
inlineprotectedvirtual

Callback method. Is called to check if we have an incomplete element

Returns
True if current element is not 0

Reimplemented from XmlSaxParser.

XmlDocument* document ( )
inline

Obtain an XmlDocument from the parsed data

Returns
The XmlDocument or 0

References XmlParent::document().

virtual void endElement ( const String name)
protectedvirtual

Complete current element

Parameters
nameThe end tag name

Reimplemented from XmlSaxParser.

XmlFragment* fragment ( )
inline

Obtain an XmlFragment from the parsed data

Returns
The XmlFragment or 0

References XmlParent::fragment().

virtual void gotCdata ( const String data)
protectedvirtual

Append a xml CData in the xml tree

Parameters
dataThe CData content

Reimplemented from XmlSaxParser.

virtual void gotComment ( const String text)
protectedvirtual

Append a xml comment in the xml tree

Parameters
textThe comment content

Reimplemented from XmlSaxParser.

virtual void gotDeclaration ( const NamedList decl)
protectedvirtual

Append a xml declaration in the xml tree

Parameters
declThe declaration content

Reimplemented from XmlSaxParser.

virtual void gotDoctype ( const String doc)
protectedvirtual

Append a xml doctype in the xml tree

Parameters
docThe doctype content

Reimplemented from XmlSaxParser.

virtual void gotElement ( const NamedList element,
bool  empty 
)
protectedvirtual

Append a xml element in the xml tree

Parameters
elementThe element content
emptyTrue if the element does not have attributes

Reimplemented from XmlSaxParser.

virtual void gotProcessing ( const NamedString instr)
protectedvirtual

Append a xml instruction in the xml tree

Parameters
instrThe instruction content

Reimplemented from XmlSaxParser.

virtual void gotText ( const String text)
protectedvirtual

Append a xml text in the xml tree

Parameters
textThe text content

Reimplemented from XmlSaxParser.

bool isCurrent ( const XmlElement el) const
inline

Check if the current element is the given one

Parameters
elThe element to compare with
Returns
True if they are equal
virtual void reset ( )
virtual

Reset parser

Reimplemented from XmlSaxParser.


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