Model Railroad System  2.2.2
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ParseXML Class Reference

Class to hold an XML tree. More...

Public Member Functions

 ParseXML (name, xml,...)
 The constructor parses the XML string and stores it as a child of the rootnode component. More...
 
 displayTree (fp="stdout")
 Display the XML tree. More...
 

Static Public Member Functions

static validate (object)
 Validation typemethod. More...
 

Private Member Functions

 _elementstart (tag, attrlist,...)
 Callback called at the start of of XML element. More...
 
 _elementend (tag,...)
 Callback called at the end of an XML element. More...
 
 _characterdata (data)
 Callback called with the text enclosed by an element. More...
 

Private Attributes

 rootnode
 The (dummy) root node. More...
 
 nodeStack
 Temp variable used during parsing. More...
 

Detailed Description

Class to hold an XML tree.

This class parses an XML string and stores the result as a DOM Element tree.

Parameters
nameGenerally %%AUTO%% is passed.
xmlThe XML string.
_Options. None at present.

Constructor & Destructor Documentation

◆ ParseXML()

ParseXML::ParseXML ( name  ,
xml  ,
  ... 
)

The constructor parses the XML string and stores it as a child of the rootnode component.

Parameters
xmlThe XML string.
_Options. None at present.

Member Function Documentation

◆ _characterdata()

ParseXML::_characterdata ( data  )
private

Callback called with the text enclosed by an element.

Parameters
dataThe text enclosed by an element. puts stderr "*** $self _characterdata: nodeStack = $nodeStack"

◆ _elementend()

ParseXML::_elementend ( tag  ,
  ... 
)
private

Callback called at the end of an XML element.

Parameters
tagThe element's tag.
_The element's options.

◆ _elementstart()

ParseXML::_elementstart ( tag  ,
attrlist  ,
  ... 
)
private

Callback called at the start of of XML element.

Parameters
tagThe element's tag.
attrlistThe element's attribute list.
_The element's options.

◆ displayTree()

ParseXML::displayTree ( fp  = "stdout")

Display the XML tree.

Parameters
fpThe channel to write the display to.

◆ validate()

static ParseXML::validate ( object  )
static

Validation typemethod.

Raises an error if its argument is not a ParseXML object.

Parameters
objectThe object to typecheck.
Returns
The object or raise an error.

Member Data Documentation

◆ nodeStack

ParseXML::nodeStack
private

Temp variable used during parsing.

◆ rootnode

ParseXML::rootnode
private

The (dummy) root node.