Doc,

That's just where I based my xml writing scrip on.

An example from the posts referred to that shows how to write an entirely new XML file.
If you know the new structure and values of the xml file you could do something like this (thanx to Shawn, Jose and Jim).

Remember that reading this XML stuff is very, VERY, VERY , case sensitive. I learned the hard way and that s#cked.

Code:

Break on
;
$filename = "d:\xmltest\test.xml"
;
$xml = LoadXml($filename)
;
$rc = WriteXmlValue($xml, "Test1a/Test1b/Test1c", Test1)
$rc = WriteXmlValue($xml, "Test2a/Test2b/Test2c", Test2)
$rc = WriteXmlValue($xml, "Test3a/Test3b/test3c", Test3)
;
?"Value=" ReadXmlValue($xml, "Test1a/Test1b/Test1c")
;
SaveXml($xml, $filename)
;
$xml = 0
;
Exit 1
;
Function ReadXmlValue($xml, $key, optional $defaultValue)
Dim $sectionNode
$sectionNode = $xml.SelectSingleNode($key);
If NOT $sectionNode
$ReadXmlValue = $defaultValue
Else
$ReadXmlValue = $sectionNode.FirstChild.Text;
EndIf
EndFunction
;
Function LoadXml($filename)
Dim $, $rootNode
$loadXml = CreateObject("Microsoft.XMLDOM");
If NOT $loadXml
Return
EndIf

$= $loadXml.Load($filename)
EndFunction
;
Function WriteXmlValue($xml, $path, $value)
Dim $p, $rootNode, $sectionNode, $parentNode, $childNode
$sectionNode = $xml.SelectSingleNode($path);
If NOT $sectionNode
$parentNode = $xml
For Each $node in Split($path,"/")
$p = $p + $node
$sectionNode = $xml.SelectSingleNode($p)
If NOT $sectionNode
$sectionNode = $xml.CreateElement($node)
$parentNode = $parentNode.AppendChild($sectionNode)
Else
$parentNode = $sectionNode
EndIf
$p = $p + "/"
Next
EndIf
If $sectionNode
$sectionNode.Text = $value
EndIf
EndFunction
;
Function SaveXml($xml, $filename)
$SaveXml = $xml.Save($filename);
EndFunction



Edited by Mart (2006-10-18 10:24 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.