Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

IRmXMLManager Class Reference

XML manager. More...

#include <RmXMLManager.h>

List of all members.

Public Member Functions

 IRmXMLManager ()
 Constructor.

virtual ~IRmXMLManager ()
 Destructor.

virtual int InitXMLDocument ()=0
 Initialize document.

virtual void DeleteXMLDocument (int hDoc)=0
 Close XML document.

virtual bool LoadFromFile (int hDoc, const RM_TCHAR *strFileName)=0
 Load from file.

virtual bool SaveToFile (int hDoc, const RM_TCHAR *strFileName)=0
 Save to file.

virtual bool GetAttributeValue (int hDoc, const RM_TCHAR *strXPath, const RM_TCHAR *strAttribName, RmStringT &result)=0
 Get attribute.

virtual bool SetAttributeValue (int hDoc, const RM_TCHAR *strXPath, const RM_TCHAR *strAttribName, const RM_TCHAR *strValue)=0
 Set attribute.

virtual bool GetNodeName (int hDoc, const RM_TCHAR *strXPath, RmStringT &result)=0
 Get node name.

virtual bool AddAttribute (int hDoc, const RM_TCHAR *strXPath, const RM_TCHAR *strAttribName, const RM_TCHAR *strValue)=0
 Add attribute.

virtual bool DeleteAttribute (int hDoc, const RM_TCHAR *strXPath, const RM_TCHAR *strAttribName)=0
 Add attribute.

virtual int GetNumChildNodes (int hDoc, const RM_TCHAR *strXPath)=0
 Get number of child nodes.

virtual bool AddChildNode (int hDoc, const RM_TCHAR *strXPath, const RM_TCHAR *strNewNodeTypeName, RmStringT *pNewChildPath=NULL)=0
 Add child node.

virtual bool AddCDATANode (int hDoc, const RM_TCHAR *strXPath)=0
 Add CDATA node.

virtual bool DeleteNode (int hDoc, const RM_TCHAR *strXPath)=0
 Delete node.

virtual bool GetXPathForChild (int hDoc, const RM_TCHAR *strXPathToParent, int childIndex, RmStringT &resultXpath)=0
 Get x path for child.

virtual bool GetTypeText (int hDoc, const RM_TCHAR *xpath, RmStringT &resultText)=0
 Get type text.

virtual bool SetTypeText (int hDoc, const RM_TCHAR *xpath, const RM_TCHAR *text)=0
 Set type text.

virtual bool AddTypeText (int hDoc, const RM_TCHAR *xpath, const RM_TCHAR *name, const RM_TCHAR *text)=0
 Add type text.

virtual bool DeleteTypeText (int hDoc, const RM_TCHAR *xpath)=0
 Delete type text.

virtual bool AddNodeText (int hDoc, const RM_TCHAR *xpath, const RM_TCHAR *text)=0
 Add node text.

virtual bool ReadXMLHeader (int hDoc, bool bValidate)=0
 Read XML hader.

virtual bool AddXMLHeader (int hDoc, const RM_TCHAR *pStrRootNode, const RM_TCHAR *pStrDTDHeader=NULL)=0
 Add XML header.


Detailed Description

XML manager.

The IRmXMLManager provides an interface that hides a lot of implementation details of dealing with an xml file through MSXML. All data contained in a RenderMonkey xml (.rfx) file can be queried through this interface. The application maintains an instance of this manager, which is available through the IRmApplication::GetXMLManager() function. PlugIns would use the following code to gain access to the interface: getRmApp()->GetXMLManager();


Constructor & Destructor Documentation

IRmXMLManager::IRmXMLManager  ) 
 

Constructor.

Default constructor

virtual IRmXMLManager::~IRmXMLManager  )  [virtual]
 

Destructor.

Destructor


Member Function Documentation

virtual bool IRmXMLManager::AddAttribute int  hDoc,
const RM_TCHAR *  strXPath,
const RM_TCHAR *  strAttribName,
const RM_TCHAR *  strValue
[pure virtual]
 

Add attribute.

Add Attributes. Used when adding a specific node attribute. The specific attribute is set through the strAttribName, and the node is determined through the CPath location set in strXPath.

Parameters:
hDoc Handle to document
strXPath Path to attribute in XML
strAttribName Attribute name
strValue Value to set
Returns:
True on success

virtual bool IRmXMLManager::AddCDATANode int  hDoc,
const RM_TCHAR *  strXPath
[pure virtual]
 

Add CDATA node.

Add CDATA Node. This function will add a CDATA block to an xml node. CDATA. Use the IRmXMLManager::SetTypeText function to save a string of text into the CDATA block. CDATA sections will not be parsed as xml.

Parameters:
hDoc Handle to document
strXPath Path to node in XML
Returns:
True on success

virtual bool IRmXMLManager::AddChildNode int  hDoc,
const RM_TCHAR *  strXPath,
const RM_TCHAR *  strNewNodeTypeName,
RmStringT *  pNewChildPath = NULL
[pure virtual]
 

Add child node.

Add child node. This function will add a new node to the XML tree. This can be used to manually add a new xml node type, and then the user can manually add attributes as necessary. If this is done, the user must be certain to follow the rules outlined by the DTD, otherwise load warnings may be issued upon xml validation failures. The strNewNodeTypeName parameter is not to be confused with the NAME attribute.

Parameters:
hDoc Handle to document
strXPath Path to node in XML
strNewNodeTypeName New node type name
pNewChildPath Path to child node
Returns:
True on success

virtual bool IRmXMLManager::AddNodeText int  hDoc,
const RM_TCHAR *  xpath,
const RM_TCHAR *  text
[pure virtual]
 

Add node text.

This function can be used to add whitespace to the xml file. This will greatly aid in keeping the file readable in a general text editor.

Parameters:
hDoc Handle to document
xpath Path in XML
text Text to add to ndoe
Returns:
True on success

virtual bool IRmXMLManager::AddTypeText int  hDoc,
const RM_TCHAR *  xpath,
const RM_TCHAR *  name,
const RM_TCHAR *  text
[pure virtual]
 

Add type text.

Used to add a text type xml node data. Used in conjunction with IRmXMLManager::AddCDATANode, these functions will add/delete the block data.

Parameters:
hDoc Handle to document
xpath Path in XML
name Name string
text Text to set
Returns:
True on success

virtual bool IRmXMLManager::AddXMLHeader int  hDoc,
const RM_TCHAR *  pStrRootNode,
const RM_TCHAR *  pStrDTDHeader = NULL
[pure virtual]
 

Add XML header.

This function is used to add a specific DTD to the xml file. The DTD that will dictate the acceptable structure of the created xml.

Parameters:
hDoc Handle to document
pStrRootNode Parh to root node
pStrDTDHeader DTD header string
Returns:
True on success

virtual bool IRmXMLManager::DeleteAttribute int  hDoc,
const RM_TCHAR *  strXPath,
const RM_TCHAR *  strAttribName
[pure virtual]
 

Add attribute.

Delete Attributes. Used when deleting a specific node attribute. The specific attribute is set through the strAttribName, and the node is determined through the CPath location set in strXPath.

Parameters:
hDoc Handle to document
strXPath Path to attribute in XML
strAttribName Attribute name
Returns:
True on success

virtual bool IRmXMLManager::DeleteNode int  hDoc,
const RM_TCHAR *  strXPath
[pure virtual]
 

Delete node.

Delete node. THis function will delete an xml node branch, as specified by the XPath location strXPath. This can be used after reading node type specific data branches, to prevent RenderMonkey from trying to 'create' these nodes, which are not recignized runtime database node types.

Parameters:
hDoc Handle to document
strXPath Path to node in XML
Returns:
True on success

virtual bool IRmXMLManager::DeleteTypeText int  hDoc,
const RM_TCHAR *  xpath
[pure virtual]
 

Delete type text.

Used to delete a text type xml node data. Used in conjunction with IRmXMLManager::AddCDATANode, these functions will add/delete the block data.

Parameters:
hDoc Handle to document
xpath Path in XML
Returns:
True on success

virtual void IRmXMLManager::DeleteXMLDocument int  hDoc  )  [pure virtual]
 

Close XML document.

Closes XML document, hDoc is a handle returned by InitXMLDocument. This function will get called after the xml document has been fully loaded or saved, and no further xml operations are needed.

Parameters:
hDoc Handle to document opened by InitXMLDocument

virtual bool IRmXMLManager::GetAttributeValue int  hDoc,
const RM_TCHAR *  strXPath,
const RM_TCHAR *  strAttribName,
RmStringT &  result
[pure virtual]
 

Get attribute.

Returns true if success, false otherwise. strXPath is the XPath location of the node, and strAttribName is the xml attribute name. Please refer to the ..rfx files for details regarding the expected xml structure. The DTD is included in all saved workspaces, and is used as part of the load xml validation procedure.

Parameters:
hDoc Handle to document
strXPath Path to attribute in XML
strAttribName Attribute name
result Result gets put into this
Returns:
True on success

virtual bool IRmXMLManager::GetNodeName int  hDoc,
const RM_TCHAR *  strXPath,
RmStringT &  result
[pure virtual]
 

Get node name.

Node Name. Given the XPath location of the node, GetNodeName will return the xml name at the location. This name is normally the RenderMonkey node type, and should be used to determine what attributes should get loaded. This string can be used in the IRmApplication::CreateNode function to create a node of the specified type.

Parameters:
hDoc Handle to document
strXPath Path to node in XML
result Result gets put into this
Returns:
True on success

virtual int IRmXMLManager::GetNumChildNodes int  hDoc,
const RM_TCHAR *  strXPath
[pure virtual]
 

Get number of child nodes.

Returns number of child nodes under given node. This function is used to determine how many calls to IRmXMLManager::GetXPathForChild are required to read in an entire xml tree branch.

Parameters:
hDoc Handle to document
strXPath Path to node in XML
Returns:
Number of children nodes

virtual bool IRmXMLManager::GetTypeText int  hDoc,
const RM_TCHAR *  xpath,
RmStringT &  resultText
[pure virtual]
 

Get type text.

Used to Get a text type xml node data. Used in conjunction with IRmXMLManager::AddCDATANode, these functions will get/set the block data.

Parameters:
hDoc Handle to document
xpath Path in XML
resultText Type text gets put into this
Returns:
True on success

virtual bool IRmXMLManager::GetXPathForChild int  hDoc,
const RM_TCHAR *  strXPathToParent,
int  childIndex,
RmStringT &  resultXpath
[pure virtual]
 

Get x path for child.

Returns complete XPath for child, given path to parent and nIndex of the child. Used in conjunction with IRmXMLManager::GetNumChildNodes, this is used to programatically traverse the entire xml DOM tree.

Parameters:
hDoc Handle to document
strXPath Path to parent node in XML
childIndex Index to children nodes
resultXpath Result path gets put into this
Returns:
True on success

virtual int IRmXMLManager::InitXMLDocument  )  [pure virtual]
 

Initialize document.

Creates XML document and returns handle ( integer ). This function gets called before an xml document can be loaded or saved using this interface, and is normally called immediately after the interface pointer has been received through the application. The returned handle is used in all remaining interface function calls.

Returns:
Handle to XML document

virtual bool IRmXMLManager::LoadFromFile int  hDoc,
const RM_TCHAR *  strFileName
[pure virtual]
 

Load from file.

Load From File. This function will load the specified an xml file, and store the resulting DOM internally. The user must use the access functions outlined below to query the DOM about the loaded data. If the xml failed xml validation, and the the user set the bValidate flag to true through the IRmXMLManager::ReadXMLHeader function, then a popup dialog will detail the error for the user.

Parameters:
hDoc Handle to document
strFileName XML file path name
Returns:
True on success

virtual bool IRmXMLManager::ReadXMLHeader int  hDoc,
bool  bValidate
[pure virtual]
 

Read XML hader.

This function is used to set the validation flag when loading an xml file. The xml "header" contains a DTD that can dictate the acceptable structure of the included xml.

Parameters:
hDoc Handle to document
bValidate Flag to trigger validation as XML header is read
Returns:
True on success

virtual bool IRmXMLManager::SaveToFile int  hDoc,
const RM_TCHAR *  strFileName
[pure virtual]
 

Save to file.

Save to File. This function will save the loaded DOM into the specified xml file.

Parameters:
hDoc Handle to document
strFileName XML file path name
Returns:
True on success

virtual bool IRmXMLManager::SetAttributeValue int  hDoc,
const RM_TCHAR *  strXPath,
const RM_TCHAR *  strAttribName,
const RM_TCHAR *  strValue
[pure virtual]
 

Set attribute.

Returns true if success, false otherwise. strXPath is the XPath location of the node, and strAttribName is the xml attribute name. Please refer to the ..rfx files for details regarding the expected xml structure. The DTD is included in all saved workspaces, and is used as part of the load xml validation procedure.

Parameters:
hDoc Handle to document
strXPath Path to attribute in XML
strAttribName Attribute name
strValue String to set
Returns:
True on success

virtual bool IRmXMLManager::SetTypeText int  hDoc,
const RM_TCHAR *  xpath,
const RM_TCHAR *  text
[pure virtual]
 

Set type text.

Used to set a text type xml node data. Used in conjunction with IRmXMLManager::AddCDATANode, these functions will get/set the block data.

Parameters:
hDoc Handle to document
xpath Path in XML
text Type text to set
Returns:
True on success


The documentation for this class was generated from the following file:
Generated on Fri Feb 25 16:08:51 2005 for RenderMonkey SDK by doxygen 1.3.6