ph_updatexml PowerHome formula function
Description
Updates an attribute in an XML string identified by a sequence of 1 or more element names and a specified instance number
Syntax
ph_updatexml ( as_xml, as_key, ai_instance, as_value )
Argument Description
as_xml String. A string containing XML data whose attribute you wish to update
as_key String. An XML element name identifying the attribute. If you want to fully qualify a heirarchy of elements, separate element names with a "<" character. Only the rightmost element name will have its attribute updated
ai_instance Integer. The matching instance number you would like to update. Use a value of 1 to update the first matching instance
as_value String. The value to assign to the matching element attribute
Return value
String. Returns the as_xml string with the identified element attribute updated with the string in as_value. Returns "*ERROR* - Could not locate key" if the specified element name sequence and instance could not be found 
Usage
Use this function to update specific attributes within XML data 
Examples
The following examples demonstrate typical syntax/usage for this function.
• ph_updatexml(ph_readfile("c:\powerhome\phdata.xml"),"row>temperature",3,"76.0") - Returns the full string of XML that was contained in the c:\powerhome\phdata.xml file with the 3rd instance of element names matching <row>...<temperature>...</temperature>...</row>. The value of the temperature element will be "<temperature>76.0</temperature>"