VR-Forces 4.0.4 Class Documentation
Public Member Functions | Protected Member Functions | Protected Attributes
DtBaseXmlReader Class Reference

Represents a reader class that interacts with libXml to read the Di-Guy character digest file. More...

Inheritance diagram for DtBaseXmlReader:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 DtBaseXmlReader ()
 Default constructor.
 DtBaseXmlReader (xmlNodePtr root, xmlNodePtr node)
virtual ~DtBaseXmlReader ()
 Destructor.
 DtBaseXmlReader (const DtBaseXmlReader &node)
 Copy constructor.
DtBaseXmlReaderoperator= (const DtBaseXmlReader &orig)
 Assignment operator.
virtual xmlNodePtr findNode (xmlNodePtr node, const char *nodeName)
 Finds the first node whose tag matches the one given by nodeName.
virtual xmlNodePtr findNode (xmlNodePtr node, const char *nodeName, const char *attrName, const char *attrValue)
 Finds the node named as nodeName and that also has an attribute named attrName with a value of attrValue.
virtual DtString getAttrValue (xmlNodePtr node, const char *attrname) const
 Returns the value of the attribute attrname inside the node.
virtual DtString getAtomicNodeValue (xmlNodePtr node, const char *nodeName)
 Returns the value of an "atomic" node.
virtual void nextNode (xmlNodePtr &node)
virtual xmlNodePtr getRootNode ()

Protected Member Functions

virtual DtString getAtomicNodeValue (xmlNodePtr node) const
 Returns the value of an "atomic" node.
virtual xmlNodePtr getChildren (xmlNodePtr node) const
 Returns a pointer to the first child of the node or NULL if not defined The reason for this method is because libXml also includes blank text nodes sometimes, so they need to be filtered out.

Protected Attributes

xmlNodePtr myRootNode
xmlNodePtr myCurNode

Detailed Description

Represents a reader class that interacts with libXml to read the Di-Guy character digest file.

Represents a reader class that interacts with libXml to read an xml file that is represented as a n-ary tree document in which the tags contained inside other tags are represented as parent-child relationships. For example,

 <Ellipsoid name="WGS84">
   <SemiMajorRadius>6378137</SemiMajorRadius>
   <SemiMinorRadius>6356752.31424518</SemiMinorRadius>
 </Ellipsoid>

is represented as a tree with the Ellipsoid node as the father and SemiMajorRadius and SemiMinorRadius as children. Both SemiMajorRadius and SemiMinorRadius are considered atomic nodes since they have no child tags.


Constructor & Destructor Documentation

Default constructor.

DtBaseXmlReader::DtBaseXmlReader ( xmlNodePtr  root,
xmlNodePtr  node 
)
virtual DtBaseXmlReader::~DtBaseXmlReader ( ) [virtual]

Destructor.

Copy constructor.


Member Function Documentation

DtBaseXmlReader& DtBaseXmlReader::operator= ( const DtBaseXmlReader orig)

Assignment operator.

virtual xmlNodePtr DtBaseXmlReader::findNode ( xmlNodePtr  node,
const char *  nodeName 
) [virtual]

Finds the first node whose tag matches the one given by nodeName.

Parameters:
nodeStarting node for the search inside the xml document
nodeNameName of the node to be searched (e.g. "GridStructure")
Returns:
0 if no matches are found.
virtual xmlNodePtr DtBaseXmlReader::findNode ( xmlNodePtr  node,
const char *  nodeName,
const char *  attrName,
const char *  attrValue 
) [virtual]

Finds the node named as nodeName and that also has an attribute named attrName with a value of attrValue.

For example, findNode(nodeptr, "GridStructure", "name", "abc") searches for a node that looks like

<GridStructure name="abc">
...
</GridStructure>

Returns:
0 if no matches are found.
virtual DtString DtBaseXmlReader::getAttrValue ( xmlNodePtr  node,
const char *  attrname 
) const [virtual]

Returns the value of the attribute attrname inside the node.

Attributes are specified inside the node like this

<node attrname=value ...>
...
</node>

Parameters:
nodeNode to access
attrnameName of the attribute to be searched (e.g. "name")
Returns:
The attribute's value if present or an empty DtSring otherwise.
virtual DtString DtBaseXmlReader::getAtomicNodeValue ( xmlNodePtr  node,
const char *  nodeName 
) [virtual]

Returns the value of an "atomic" node.

Atomic nodes are the ones that have the following structure <tag>value</tag>.

Parameters:
nodeNode to start the search of the atomic node
nodeNameName of the atomic node to be searched
Returns:
It returns an empty DtString if the node has the form or <tag></tag>
virtual void DtBaseXmlReader::nextNode ( xmlNodePtr &  node) [virtual]
Returns:
the next node which is not a blank text node
virtual xmlNodePtr DtBaseXmlReader::getRootNode ( ) [inline, virtual]
Returns:
the top root node of this reader
virtual DtString DtBaseXmlReader::getAtomicNodeValue ( xmlNodePtr  node) const [protected, virtual]

Returns the value of an "atomic" node.

Atomic nodes are the ones that have the following structure <tag>value</tag>. It returns the empty string if the node has the form or <tag></tag>

virtual xmlNodePtr DtBaseXmlReader::getChildren ( xmlNodePtr  node) const [protected, virtual]

Returns a pointer to the first child of the node or NULL if not defined The reason for this method is because libXml also includes blank text nodes sometimes, so they need to be filtered out.

This function guarantees you get an actual child node as the first node


Member Data Documentation

xmlNodePtr DtBaseXmlReader::myRootNode [protected]
xmlNodePtr DtBaseXmlReader::myCurNode [protected]

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

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)