Infrasctucture Xml Function Reference

Xml
#include "xml.h"

The xml module and it's two associated executables (x2h, pntXml) provide a limited ability to examine xml docs and convert them to html.    These are used to build and maintain the master index and layer sub-pages of the infrastructure documentation.    All tags MUST have a closing tag else the xmParse function will barf complaining about badly formed XML.    You can embed HTML tags within xml tagged fields by placing a BACKSLASH (as an escape) just before the opening lessthan '<' of the HTML tag.    If the first character of a tag is a question mark '?', the entire tag is assumed to be a comment and ignored by xmParse().
   An inputfile is read into a single string and then parsed into a structure chain of tags.    The tag chain and subsequent tags are accessed by handles of type void*.    From a tag chain the xml structure may be searched and tags handles returned.   
The utility pntXml prints an indented tree of the entire XML document and is a good way to examine the quality of an xml file.
The utility x2h converts the command line list of .xml files to an entire website with an index containing a table of the modules hyperlinked to the sub-sections which contains a table of the module's functions, each hyperlinked to the fuction description.   

xmFndTag     xmFree     xmGetTagVal     xmMerge     xmParse     xmPnt    
xmRdFil     xmTran     xmVal    

char*  xmFndTag( void* tagChain, char* tagName )
Search the tags chain for the specified tag.    The tag specification ("tagName") is actually a TAG1/TAG2 string meaning that the tag chain is searched for "TAG1" then Tag1's sub-tags are searched for "TAG2".    This operation is recursive.    Returns handle to the requested tag structure else NULL.   

int  xmFree( void* file )
Frees the supplied ascii xml file and returns OK.   

int  xmGetTagVal( char* out, char* tagChain, char* file )
Directly parses an ascii xml file, and then searches the tag tree for the specified tag, copying the tag value to the output buffer.    Returns OK if tag found, else NOTFND.

char*  xmMerge( char* htmlTemplate, char** data, int dataLen )
Merge the data into the htmlTemplate. "data" is an array of string pointers. xmMerge scans the htmlTemplate looking for "%nbr%" entries. When a "%nbr%" entry is found, is is replaced with the "data" entry indexed by "nbr" bracketed by percents '%'. Returns a new string containing the expanede template, the original template string is freed.

void*  xmParse( char* file )
Parse the xml file string, into tag_t structures returning a handle for the resultant chain of tags, else NULL.

int  xmPnt( char* xmlFile, int level )
Parse the string containing an xml file, into a chain of tag_t structures, then traverse the chain printing the tag and sub-tag names and values as an indented list.

char*  xmRdFil( char* file )
Reads the specified file and returns it as a single large string, else NULL.

char*  xmTran( char* file )
Traverse a tag chain.    Not invented yet!!!!!!!!!!11

char*  xmVal( void* tagHandle )
Returns a pointer to the value field of the supplied tag handle.