fwInstallation  8.4.1
Functions | Variables
fwInstallationXml.ctl File Reference

Functions

int fwInstallationXml_childNodesContent (unsigned doc, int node, dyn_string &node_names, dyn_anytype &attributes, dyn_string &nodevalues, dyn_string &exceptionInfo)
 
int fwInstallationXml_get (string docPath, dyn_string &tags, dyn_string &values, dyn_anytype &attribs)
 
int fwInstallationXml_getTag (string docPath, string tag, dyn_string &FilteredValues, dyn_anytype &FilteredAttribs)
 
int fwInstallationXml_createComponentFile (string pathName, dyn_dyn_mixed componentInfo)
 
int fwInstallationXml_load (string fileName, dyn_dyn_mixed &componentInfo)
 
int _fwInstallationXml_FindWildcardFiles (string tagValue, string fileName, dyn_string &tmpFiles)
 
int fwInstallationXml_parseFile (string sourceDir, string descFile, string subPath, string destinationDir, dyn_dyn_mixed &parsedComponentInfo)
 
int fwInstallationXml_getTagFromString (string &tagName, string &tagValue, string &strComponentFile)
 

Variables

const string csFwInstallationXmlLibVersion = "8.4.1"
 
const string fwInstallation_Xml_CHILDNODESTYPE = "fwXml_ChildNodesType"
 
const string fwInstallation_Xml_CHILDSUBTREEID = "fwXml_ChildSubTreeId"
 
fwInstallation.ctl: Definition of constants

The following constants define the indeces of the different elements in the component XML file when passed as a dyn_dyn_mixed matrix

const int FW_INSTALLATION_XML_COMPONENT_NAME = 1
 
const int FW_INSTALLATION_XML_COMPONENT_VERSION = 2
 
const int FW_INSTALLATION_XML_COMPONENT_IS_SUBCOMPONENT = 3
 
const int FW_INSTALLATION_XML_COMPONENT_DATE = 4
 
const int FW_INSTALLATION_XML_COMPONENT_HELP_FILE = 5
 
const int FW_INSTALLATION_XML_COMPONENT_REQUIRED_COMPONENTS = 6
 
const int FW_INSTALLATION_XML_COMPONENT_DPLIST_FILES = 7
 
const int FW_INSTALLATION_XML_COMPONENT_SUBCOMPONENTS = 8
 
const int FW_INSTALLATION_XML_COMPONENT_COMMENTS = 9
 
const int FW_INSTALLATION_XML_COMPONENT_INIT_SCRIPTS = 10
 
const int FW_INSTALLATION_XML_COMPONENT_DELETE_SCRIPTS = 11
 
const int FW_INSTALLATION_XML_COMPONENT_POST_INSTALL_SCRIPTS = 12
 
const int FW_INSTALLATION_XML_COMPONENT_POST_DELETE_SCRIPTS = 13
 
const int FW_INSTALLATION_XML_COMPONENT_CONFIG_FILES = 14
 
const int FW_INSTALLATION_XML_COMPONENT_PANEL_FILES = 15
 
const int FW_INSTALLATION_XML_COMPONENT_LIBRARY_FILES = 16
 
const int FW_INSTALLATION_XML_COMPONENT_SCRIPT_FILES = 17
 
const int FW_INSTALLATION_XML_COMPONENT_OTHER_FILES = 18
 
const int FW_INSTALLATION_XML_DESC_FILE = 19
 
const int FW_INSTALLATION_XML_COMPONENT_DONT_RESTART = 20
 
const int FW_INSTALLATION_XML_COMPONENT_CONFIG_FILES_WINDOWS = 21
 
const int FW_INSTALLATION_XML_COMPONENT_CONFIG_FILES_LINUX = 22
 
const int FW_INSTALLATION_XML_COMPONENT_REQUIRED_PVSS_VERSION = 23
 
const int FW_INSTALLATION_XML_COMPONENT_STRICT_PVSS_VERSION = 24
 
const int FW_INSTALLATION_XML_COMPONENT_REQUIRED_PVSS_PATCH = 25
 
const int FW_INSTALLATION_XML_COMPONENT_PREINIT_SCRIPTS = 26
 
const int FW_INSTALLATION_XML_COMPONENT_UPDATE_TYPES = 27
 
const int FW_INSTALLATION_XML_COMPONENT_FILES = 28
 
const int FW_INSTALLATION_XML_COMPONENT_POST_INSTALL_SCRIPTS_CURRENT = 29
 
const int FW_INSTALLATION_XML_COMPONENT_POST_DELETE_SCRIPTS_CURRENT = 30
 
const int FW_INSTALLATION_XML_COMPONENT_REQUIRED_INSTALLER_VERSION = 31
 
const int FW_INSTALLATION_XML_COMPONENT_STRICT_INSTALLER_VERSION = 32
 
const int FW_INSTALLATION_XML_COMPONENT_DESCRIPTION = 33
 
const int FW_INSTALLATION_XML_COMPONENT_IS_HIDDEN_COMPONENT = 34
 
const int FW_INSTALLATION_XML_COMPONENT_BIN_FILES = 35
 
const int FW_INSTALLATION_XML_COMPONENT_QT_HELP_FILES = 36
 
const string FW_INSTALLATION_XML_TAG_ROOT_COMPONENT = "component"
 

Detailed Description

This package contains functions to manipulate the component XML description files

Author
Fernando Varela (EN-ICE)
Date
August 2010

Function Documentation

int fwInstallationXml_childNodesContent ( unsigned  doc,
int  node,
dyn_string &  node_names,
dyn_anytype &  attributes,
dyn_string &  nodevalues,
dyn_string &  exceptionInfo 
)
'fwInstallation_xmlChildNodesContent()' this function is a copy of 

'fwXml_childNodesContent' and it should be eventually replace once the fwXml.ctl is widely distributed. It returns tags, attributes and contained data of all children

Constraints
None
Usage
Public
PVSS managers
UI, CTRL
Parameters
docinput, the document identifier
nodeinput, the node identifier of the parent element-node container
node_namesoutput, the node-names or tag-names for element-nodes
attributesoutput, the attributes of element-nodes and added infomation
nodevaluesoutput, the node-values or values of the unique child's text-node
exceptionInfoinout, returns details of any exceptions
Returns
output, the combined types of the type of children which data is returned
When used for simple Xml-file structures
If the function returns '0' (zero), then the child-nodes are all element-nodes which contain at most one text-node as their child. The following is returned via the three output-parameters: 'node_names' returns the tag-names of the element-nodes, 'attributes' returns all the attributes of the element-nodes, 'nodevalues' returns the value (character-data) of the contained text-node if present, otherwise it returns the empty string.
A typical example is included in the example-panel "xmlChildNodesContentExample.pnl" (first push-button). The Xml-file "xmlExampleFlatListing.xml" can be completely read by issuing one single call to this function - specify for the 'node' variable the node-identifier of the element-node called "<room>".
Note that this function was created especially for users who want to parse Xml-files of a structure which corresponds to the above description. Only read further if you want to use this function to parse more complex Xml-file structures.
When used for complex Xml-file structures
If any of the child-nodes is different from an element-node which contains at most one text-node as its child, then the return-code will be different from '0' and will be more specific the bitwise OR-ed values which are obtained by shifting the value '1' to the left by a number of places which corresponds to the internal enumerated value of the node-type.
An example will illustrate this much easier. Refer again to the example-panel "xmlChildNodesContentExample.pnl" (second push-button). The Xml-file corresponds this time to "xmlExampleGreatText.xml". In this example there is in addition to the above at least one text-node as a direct child (not as a child of an element-node). In that case, the return-code is '8' - this is obtained by shifting '1' to the left by XML_TEXT_NODE places (1<<XML_TEXT_NODE) [1<<3].
For nodes which are not element-nodes, the returned values are: 'node_names' returns the node-name of the node as queried by 'xmlNodeName', 'attributes' returns a single mapping "[fwInstallation_Xml_CHILDNODESTYPE;(int)<node-type>]" which indicates the node-type of the node, 'nodevalues' returns the node-value of the node as queried by 'xmlNodeValue'.
If there is additionally at least one child-node with more than one child or with a child which is not a text-node then the return-code will have the bit-value '2' also set. The same example-panel "xmlChildNodesContentExample.pnl" illustrates this. Third button parses the "xmlExampleHierarchical.xml" Xml-file - return-code corresponds to '2' (1<<XML_ELEMENT_NODE) [1<<1]. Fourth button parses the Xml-file "xmlExampleMoreComplex.xml" - return-code corresponds to '10' - obtained by bitwise OR-ing of (1<<XML_ELEMENT_NODE) and (1<<XML_TEXT_NODE) which is [(1<<1)|(1<<3)].
For element-nodes with more than one child or with a child which is not a text-node, the returned values are: 'node_names' returns the tag-name of the node, 'attributes' returns all the attributes of the element-nodes with additionally the two following added mappings "[fwInstallation_Xml_CHILDNODESTYPE;(int)XML_ELEMENT_NODE]" which is the node-type and "[fwInstallation_Xml_CHILDSUBTREEID;(int)<element-node-identifier>]", 'nodevalues' returns the empty string.
int fwInstallationXml_get ( string  docPath,
dyn_string &  tags,
dyn_string &  values,
dyn_anytype &  attribs 
)

This function retrieves the contents of an XML file

Parameters
docPath(in) XML file to be parsed
tags(out) XML tags in the file as an dyn_string array
values(out) values of the XML tags
attribs(out) tag attributes
Returns
0 if OK, -1 if error, -2 when not a component file
int fwInstallationXml_getTag ( string  docPath,
string  tag,
dyn_string &  FilteredValues,
dyn_anytype &  FilteredAttribs 
)

This function the value and attributes of all entries in a XML file for a particular tag

Parameters
docPath(in) XML file to be parsed
tag(in) XML tag to look for
FilteredValues(out) values of the XML tags
FilteredAttribs(out) tag attributes
Returns
0 if OK, -1 if error, -2 if not a component file
int fwInstallationXml_createComponentFile ( string  pathName,
dyn_dyn_mixed  componentInfo 
)
This function creates a component description file (xml).
Parameters
pathName(in) path for the output file {if empty, only create xmlDesc}
componentInfo(in) dyn_dyn_mixed containing the contents of the XML file to be created
Returns
0 - xml file created, -1 - file creation failed, -2 - parameters missing
Author
Fernando Varela.
int fwInstallationXml_load ( string  fileName,
dyn_dyn_mixed &  componentInfo 
)

This function loads the contents of a component XML file into a dyn_dyn_mixed matrix

Parameters
fileName(in) fileName name of the component xml file
componentInfo(out) XML file contents as a dyn_dyn_mixed matrix
Returns
0 if OK, -1 if error
int _fwInstallationXml_FindWildcardFiles ( string  tagValue,
string  fileName,
dyn_string &  tmpFiles 
)

This function finds all files that matches to the given pattern with wildcard (*)

Parameters
tagValue(in) XML tag
fileName(in) fileName name of the component xml file
tmpFiles(out) list of matched files
Returns
number of found files
int fwInstallationXml_parseFile ( string  sourceDir,
string  descFile,
string  subPath,
string  destinationDir,
dyn_dyn_mixed &  parsedComponentInfo 
)

This funcion parses a XML file. Contrarily to fwInstallationXML_load, this function prepends the relative destination path to the files

Parameters
sourceDir(in) source directory
descFile(in) XML description file
subPath(in) path to the appended to the source directory
destinationDir(in) destination directory where the component will be installed
parsedComponentInfo(out) resulting component info
Returns
0 if OK, -1 if error
int fwInstallationXml_getTagFromString ( string &  tagName,
string &  tagValue,
string &  strComponentFile 
)

This funcion parses a string representing xml element

Parameters
tagName(out) name of the tag
tagValue(out) value of the tag
strComponentFile(in) XML file parsed as a string
Returns
0 if OK, -1 if error

Variable Documentation

const string csFwInstallationXmlLibVersion = "8.4.1"

Version of this library. Used to determine the coherency of all libraries of the installation tool Please do not edit it manually

const string fwInstallation_Xml_CHILDNODESTYPE = "fwXml_ChildNodesType"

Constant used in the mapping that identifies the node-type of the node in question

const string fwInstallation_Xml_CHILDSUBTREEID = "fwXml_ChildSubTreeId"

Constant used in the mapping that identifies the node-identifier of the node in question