Damn. I thought I did...
Here's the Overload code implemented into a function. Works great. I guess I'll retrofit all of the function to use this before I tackle the other funcs. I'll update the post aobve with the language changes and this.
Code:
; WriteXMLValue() - Writes a value to an XML element
Function WriteXMLValue($source, $path, $value)
dim $, $p, $rootNode, $sectionNode, $parentNode, $childNode, $node, $xml
; Begin Overloaded Var Sorting
If VarType($source) = 9
; An object was passed
$xml = $source
Else
If Instr($source,"<")=0
; A file name was passed
$xml = LoadXML($source)
Else
; An XML string was passed
$xml = CreateObject("Microsoft.XMLDOM")
$xml.async = false
$=$xml.loadXML($source)
EndIf
EndIf
; End Overloaded Var Sorting
$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
; Begin Overloaded Var Exit Strategy
If VarType($source) = 9
; An object was passed. Since the object was passed by ref, no further
; action necessary.
Else
If Instr($source,"<")=0
; A file name was passed, so we write it out and destory the object
SaveXML($xml, $source)
$xml = 0
Else
; An XML string was passed
; Cannot save the XML string as we have no file name to save to
; so we return it. Since the object was passed by ref, no further
; action necessary.
EndIf
EndIf
; End Overloaded Var Exit Strategy
endfunction