VR-Forces 4.10 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | 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...

Public Member Functions

 DtBaseXmlReader ()
 Default constructor. More...
 
 DtBaseXmlReader (xmlNodePtr root, xmlNodePtr node)
 
virtual ~DtBaseXmlReader ()
 Destructor. More...
 
 DtBaseXmlReader (const DtBaseXmlReader &node)
 Copy constructor. More...
 
DtBaseXmlReaderoperator= (const DtBaseXmlReader &orig)
 Assignment operator. More...
 
virtual xmlNodePtr findNode (xmlNodePtr node, const char *nodeName)
 Finds the first node whose tag matches the one given by nodeName. More...
 
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. More...
 
virtual DtString getAttrValue (xmlNodePtr node, const char *attrname) const
 Returns the value of the attribute attrname inside the node. More...
 
virtual DtString getAtomicNodeValue (xmlNodePtr node, const char *nodeName)
 Returns the value of an "atomic" node. More...
 
virtual void nextNode (xmlNodePtr &node)
 
virtual xmlNodePtr getRootNode ()
 

Protected Member Functions

virtual DtString getAtomicNodeValue (xmlNodePtr node) const
 Returns the value of an "atomic" node. More...
 
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. More...
 

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

DtBaseXmlReader::DtBaseXmlReader ( )

Default constructor.

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

Destructor.

DtBaseXmlReader::DtBaseXmlReader ( const DtBaseXmlReader node)

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 ( )
inlinevirtual
Returns
the top root node of this reader
virtual DtString DtBaseXmlReader::getAtomicNodeValue ( xmlNodePtr  node) const
protectedvirtual

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
protectedvirtual

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 Tue Sep 21 17:42:52 EDT 2021 from SVN revision 234861
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)