|
Yate
|
Serial Access XML Parser. More...
#include <yatexml.h>
Public Member Functions | |
| virtual | ~XmlSaxParser () |
| unsigned int | offset () const |
| unsigned int | row () const |
| unsigned int | column () const |
| const String & | buffer () 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) |
| virtual void | reset () |
| const String & | getBuffer () 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) |
| void | debugSet (const char *desc) |
Static Public Member Functions | |
| 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 String & | escape (String &buf, const String &text) |
| static bool | unEscape (String &text, String *error, bool *found=0) |
| static bool | unEscape (String &text, const char *str, unsigned int len, String *error, bool inText=false, bool *found=0) |
Static Public Attributes | |
| static const TokenDict | s_errorString [] |
| static const XmlEscape | s_escape [] |
Protected Member Functions | |
| 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 () |
| String * | extractName (bool &empty) |
| NamedString * | getAttribute () |
| 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 () |
| bool | processElement (NamedList &list, bool empty) |
| bool | processText (String &text) |
Protected Member Functions inherited from DebugEnabler | |
| void | debugName (const char *name) |
Protected Attributes | |
| unsigned int | m_offset |
| unsigned int | m_row |
| unsigned int | m_column |
| Error | m_error |
| String | m_buf |
| NamedList | m_parsed |
| Type | m_unparsed |
Serial Access XML Parser.
A Serial Access Parser (SAX) for arbitrary XML data
|
virtual |
Destructor
|
protected |
Constructor
| name | Debug name |
|
protected |
Parse an unfinished xml object. Extracts the parsed string from buffer if returns true
|
inlineprotected |
Check if a character is an angle bracket
| c | The character to verify |
|
inlinestatic |
Check if the given character is blank
| c | The character to verify |
|
inline |
|
static |
Check if the given character is in the range allowed for an xml char
| c | The character to check |
|
inlinestatic |
Verify if the given character is in the range allowed to be first character from a xml tag
| ch | The character to check |
Referenced by XmlSaxParser::checkNameCharacter().
|
inlinestatic |
Verify if the given character is in the range allowed for a xml name
| ch | The character to check |
References XmlSaxParser::checkFirstNameCharacter().
|
inline |
Get the column where the parser has found an error
References XmlSaxParser::m_column.
|
inlineprotectedvirtual |
Callback method. Is called to check if we have an incomplete element. Default implementation returns always true
Reimplemented in XmlDomParser.
| bool completeText | ( | ) |
Process incomplete text if the parser is completed. This method should be called to complete text after all data was pushed into the parser
|
inlineprotectedvirtual |
Callback method. Is called when a end tag was successfully parsed. Default implementation does nothing
| name | The end tag name |
Reimplemented in XmlDomParser.
|
inline |
Get the error code found while parsing
References XmlSaxParser::m_error.
Referenced by XmlSaxParser::unEscape().
XmlEscape the given text
| buf | Destination buffer |
| text | The text to escape |
|
protected |
Extract the name of an element or instruction
|
protected |
Extract an attribute
|
inline |
References XmlSaxParser::m_buf.
|
inline |
Retrieve the error string associated with current error status
| defVal | Value to return if not found |
References XmlSaxParser::getError(), and XmlSaxParser::m_error.
Referenced by XmlSaxParser::getError().
|
inlinestatic |
Retrieve the error string associated with a given error code
| code | Code of the error to look up |
| defVal | Value to return if not found |
References XmlSaxParser::s_errorString.
|
inlineprotectedvirtual |
Callback method. Is called when a CData section was successfully parsed. Default implementation does nothing
| data | The CData content |
Reimplemented in XmlDomParser.
|
inlineprotectedvirtual |
Callback method. Is called when a comment was successfully parsed. Default implementation does nothing
| text | The comment content |
Reimplemented in XmlDomParser.
|
inlineprotectedvirtual |
Callback method. Is called when a declaration was successfully parsed. Default implementation does nothing
| decl | The declaration content |
Reimplemented in XmlDomParser.
|
inlineprotectedvirtual |
Callback method. Is called when a doctype was successfully parsed. Default implementation does nothing
| doc | The doctype content |
Reimplemented in XmlDomParser.
|
inlineprotectedvirtual |
Callback method. Is called when an element was successfully parsed. Default implementation does nothing
| element | The element content |
| empty | True if the element does not have attributes |
Reimplemented in XmlDomParser.
|
inlineprotectedvirtual |
Callback method. Is called when an instruction was successfully parsed. Default implementation does nothing
| instr | The instruction content |
Reimplemented in XmlDomParser.
|
inlineprotectedvirtual |
Callback method. Is called when a text was successfully parsed. Default implementation does nothing
| text | The text content |
Reimplemented in XmlDomParser.
|
inline |
Get the number of bytes successfully parsed
References XmlSaxParser::m_offset.
| bool parse | ( | const char * | data | ) |
Parse a given string
| data | The data to parse |
|
protected |
Parse a CData section form the main buffer. Extracts the parsed string from buffer if returns true
|
protected |
Parse a comment form the main buffer. Extracts the parsed string from buffer if returns true
|
protected |
Parse a declaration form the main buffer. Extracts the parsed string from buffer if returns true
|
protected |
Parse a doctype form the main buffer. Extracts the parsed string from buffer if returns true. Warning: This is a stub implementation
|
protected |
Parse an element form the main buffer. Extracts the parsed string from buffer if returns true
|
protected |
Parse an endtag form the main buffer. Extracts the parsed string from buffer if returns true
|
protected |
Parse an instruction form the main buffer. Extracts the parsed string from buffer if returns true
|
protected |
Helper method to classify the Xml objects starting with "<!" sequence. Extracts the parsed string from buffer if returns true
|
protected |
Calls gotElement() and eset parsed on success
| list | The list element and its attributes |
| empty | True if the element does not have attributes |
|
protected |
Unescape text, call gotText() and reset parsed on success
| text | The text to process |
|
virtual |
Reset error flag
Reimplemented in XmlDomParser.
|
inlineprotected |
Reset the error
References XmlSaxParser::m_error.
|
inlineprotected |
Reset parsed value and parameters
References String::clear(), NamedList::clearParams(), and XmlSaxParser::m_parsed.
|
inline |
Get the row where the parser has found an error
References XmlSaxParser::m_row.
| bool setError | ( | Error | error, |
| XmlChild * | child = 0 ) |
Set the error code and destroys a child if error code is not NoError
| error | The error found |
| child | Child to destroy |
|
inline |
Set the last xml type that we were parsing, but we have not finished
| id | The xml type that we haven't finish to parse |
References XmlSaxParser::m_unparsed.
|
protected |
Remove blank characters from the begining of the buffer
|
protected |
Unescape the given text. Handled: < > ' " & &#DecimalNumber; &#xHexNumber;
| text | The requested text to unescape |
|
static |
Unescape the given text. Handled: < > ' " & &#DecimalNumber; &#xHexNumber;
| text | The requested text to unescape |
| str | Input buffer |
| len | Input buffer length |
| inText | Use destination text during unescape. If enabled the destination text may be incomplete on failure. The method will use a temporary buffer if disabled This parameter is ignored and handled as 'false' if 'str' points to destination string's buffer |
| error | Destination for error string |
| found | Optional flag to be set if unescape was found |
Unescape the given text. Handled: < > ' " & &#DecimalNumber; &#xHexNumber;
| text | The requested text to unescape |
| error | Destination for error string |
| found | Optional flag to be set if unescape was found |
References String::c_str(), XmlSaxParser::error(), String::length(), and XmlSaxParser::unEscape().
Referenced by XmlSaxParser::unEscape().
|
inline |
References XmlSaxParser::m_unparsed.
|
static |
Check if a given string is a valid xml tag name
| buf | The string to check |
|
protected |
The main buffer
Referenced by XmlSaxParser::buffer(), and XmlSaxParser::getBuffer().
|
protected |
The column where the parser was stop
Referenced by XmlSaxParser::column().
|
protected |
The error code found while parsing data
Referenced by XmlSaxParser::error(), XmlSaxParser::getError(), and XmlSaxParser::resetError().
|
protected |
The offset where the parser was stop
Referenced by XmlSaxParser::offset().
|
protected |
The parser data holder. Keeps the parsed data when an incomplete xml object is found
Referenced by XmlSaxParser::resetParsed().
|
protected |
The row where the parser was stop
Referenced by XmlSaxParser::row().
|
protected |
The last parsed xml object code
Referenced by XmlSaxParser::setUnparsed(), and XmlSaxParser::unparsed().
|
static |
Errors dictionary
Referenced by XmlSaxParser::getError().
|
static |
Escaped strings dictionary