#include <genxmlpars.h>


Public Member Functions | |
| a2dIOHandlerXMLPull () | |
| Constructor. | |
| ~a2dIOHandlerXMLPull () | |
| Destructor. | |
| a2dXMLTag * | GetCurrentTag () |
| return the tag where the stream is situated | |
| virtual void | InitializeLoad () |
| Inits the IO handler for reading. | |
| virtual void | ResetLoad () |
| Reset the object after loading. | |
| void | Require (const XMLeventType &type, wxString name) |
| Forces a special tag. | |
| wxString | GetTagName () |
| Returns name of the current XML tag. | |
| wxString | GetContent () |
| Returns the current content. | |
| XMLeventType | GetEventType () |
| Returns the type of current event. | |
| int | GetDepth () |
| Returns depth. | |
| XMLeventType | NextTag () |
| Walks to next tag. | |
| XMLeventType | Next () |
| Walks to next element and returns event type. | |
| wxString | GetAttributeValue (const wxString &attrib, const wxString &defaultv=wxT("")) |
| Returns the value of an attribute. | |
| wxString | RequireAttributeValue (const wxString &attrib) |
| Forces an attribute and returns its string value. | |
| double | GetAttributeValueDouble (const wxString &attrib, double defaultv=0) |
| Returns the double value of an attribute. | |
| double | RequireAttributeValueDouble (const wxString &attrib) |
| Forces an attribute and returns its double value. | |
| int | GetAttributeValueInt (const wxString &attrib, int defaultv=0) |
| Returns the integer value of an attribute. | |
| wxUint16 | GetAttributeValueUint16 (const wxString &attrib, wxUint16 defaultv=0) |
| cast to wxUint16 of GetAttributeValueInt() | |
| wxUint32 | GetAttributeValueUint32 (const wxString &attrib, wxUint32 defaultv=0) |
| cast to wxUint32 of GetAttributeValueInt() | |
| int | RequireAttributeValueInt (const wxString &attrib) |
| Forces an attribute and returns its integer value. | |
| long | GetAttributeValueLong (const wxString &attrib, long defaultv=0) |
| Returns the long value of an attribute. | |
| long | RequireAttributeValueLong (const wxString &attrib) |
| Forces an attribute and returns its long integer value. | |
| bool | GetAttributeValueBool (const wxString &attrib, bool defaultv=false) |
| Returns the boolean value of an attribute. | |
| bool | RequireAttributeValueBool (const wxString &attrib) |
| Forces an attribute and returns its boolean value. | |
| bool | HasAttribute (const wxString &attrib) |
| Does the current tag have this attribute? | |
| void | SkipSubTree () |
| Skips all child elements / tags of current element / tag. | |
| virtual int | GetCurrentColumnNumber () |
| where in the input was column the current tag | |
| virtual int | GetCurrentLineNumber () |
| where in the input was line the current tag | |
Protected Member Functions | |
| virtual void | StartElementHnd (a2dXMLTag *tag) |
| virtual void | EndElementHnd (const wxString &name) |
| virtual void | CharacterDataHnd (const wxString &text) |
| virtual void | CommentHnd (const wxString &comment) |
| virtual void | DefaultHnd (const wxString &def) |
| void | FillQueue () |
| Reads next piece of document into buffer. | |
Protected Attributes | |
| a2dSmrtPtrList< a2dXMLTag > | m_elements |
| queue of begin and end elements tags not yet processed | |
| int | m_depth |
| a2dXMLTag * | m_startdoc |
| a2dXMLTag * | m_enddoc |
| a2dXMLTag * | m_current |
| current XML tag | |
The file is parsed by pulling information from it. One chunk of information is a XML begin_tag + attributes or an end_tag or content between the tags. The caller decides what should be pulled next after a reading chunk. This makes it very easy to read known fixes file formats, since one can directly store the information read into an object of choice. This is ideal for mapping a certain XML input format to the programs internal format.
See also http://www.xmlpull.org/ for further details about XML pull parsing.
Definition at line 304 of file genxmlpars.h.
| a2dIOHandlerXMLPull::a2dIOHandlerXMLPull | ( | ) |
Constructor.
Definition at line 312 of file genxmlpars.cpp.
| void a2dIOHandlerXMLPull::InitializeLoad | ( | ) | [virtual] |
Inits the IO handler for reading.
Reimplemented from a2dIOHandlerXML.
Definition at line 326 of file genxmlpars.cpp.
| void a2dIOHandlerXMLPull::Require | ( | const XMLeventType & | type, | |
| wxString | name | |||
| ) |
Forces a special tag.
If the current XMLeventType and the tag name is not the required type and name, an a2dIOHandlerXMLException will occur.
| type | the required tag type | |
| name | the required tag name |
Definition at line 389 of file genxmlpars.cpp.
| wxString a2dIOHandlerXMLPull::GetTagName | ( | ) |
Returns name of the current XML tag.
This method returns the name of the current XML tag
Definition at line 564 of file genxmlpars.cpp.
| wxString a2dIOHandlerXMLPull::GetContent | ( | ) |
Returns the current content.
Returns the content between the opening XML tag and the ending tag
Definition at line 569 of file genxmlpars.cpp.
| XMLeventType a2dIOHandlerXMLPull::GetEventType | ( | ) |
Returns the type of current event.
The event type may be one of the following:
Definition at line 604 of file genxmlpars.cpp.
| XMLeventType a2dIOHandlerXMLPull::NextTag | ( | ) |
Walks to next tag.
Does internally a call to Next() and checks if the XMLEventType is an START_TAG or END_TAG, otherwise an a2dIOHandlerXMLException is thrown.
Definition at line 410 of file genxmlpars.cpp.
| XMLeventType a2dIOHandlerXMLPull::Next | ( | ) |
Walks to next element and returns event type.
Goes to the next element and returns the event type of the element.
Definition at line 421 of file genxmlpars.cpp.
| wxString a2dIOHandlerXMLPull::GetAttributeValue | ( | const wxString & | attrib, | |
| const wxString & | defaultv = wxT("") | |||
| ) |
Returns the value of an attribute.
Returns the value of the attribute "attrib"
| attrib | the attribute name | |
| defaultv | the default value (empty string by default) |
Definition at line 449 of file genxmlpars.cpp.
| wxString a2dIOHandlerXMLPull::RequireAttributeValue | ( | const wxString & | attrib | ) |
Forces an attribute and returns its string value.
Walks through the attributes of the current start tag and returns the value of the requested attribute. If the attribute is not found, an a2dIOHandlerXMLException will be thrown.
| attrib | the attribute name |
Definition at line 460 of file genxmlpars.cpp.
| double a2dIOHandlerXMLPull::GetAttributeValueDouble | ( | const wxString & | attrib, | |
| double | defaultv = 0 | |||
| ) |
Returns the double value of an attribute.
| attrib | the attribute name | |
| defaultv | the default value (0 by default) |
Definition at line 473 of file genxmlpars.cpp.
| double a2dIOHandlerXMLPull::RequireAttributeValueDouble | ( | const wxString & | attrib | ) |
Forces an attribute and returns its double value.
| attrib | the attribute name |
Definition at line 486 of file genxmlpars.cpp.
| int a2dIOHandlerXMLPull::GetAttributeValueInt | ( | const wxString & | attrib, | |
| int | defaultv = 0 | |||
| ) |
Returns the integer value of an attribute.
| attrib | the attribute name | |
| defaultv | the default value (0 by default) |
Definition at line 494 of file genxmlpars.cpp.
| int a2dIOHandlerXMLPull::RequireAttributeValueInt | ( | const wxString & | attrib | ) |
Forces an attribute and returns its integer value.
| attrib | the attribute name |
Definition at line 507 of file genxmlpars.cpp.
| long a2dIOHandlerXMLPull::GetAttributeValueLong | ( | const wxString & | attrib, | |
| long | defaultv = 0 | |||
| ) |
Returns the long value of an attribute.
| attrib | the attribute name | |
| defaultv | the default value (0 by default) |
Definition at line 515 of file genxmlpars.cpp.
| long a2dIOHandlerXMLPull::RequireAttributeValueLong | ( | const wxString & | attrib | ) |
Forces an attribute and returns its long integer value.
| attrib | the attribute name |
Definition at line 528 of file genxmlpars.cpp.
| bool a2dIOHandlerXMLPull::GetAttributeValueBool | ( | const wxString & | attrib, | |
| bool | defaultv = false | |||
| ) |
Returns the boolean value of an attribute.
Attribute values like "true", "true", "True"... will be returned as boolean (case-insensitive).
| attrib | the attribute name | |
| defaultv | the default value |
Definition at line 536 of file genxmlpars.cpp.
| bool a2dIOHandlerXMLPull::RequireAttributeValueBool | ( | const wxString & | attrib | ) |
Forces an attribute and returns its boolean value.
| attrib | the attribute name |
Definition at line 550 of file genxmlpars.cpp.