Thanks for the reply.
I was hoping to insert the block without having to iterate through the xml to be inserted (meaning, I would just like to insert the raw XML into the current document).
Another question, I noticed that the performance of the code I am using to convert data into XML degrades according to the size of the document. Is there a more efficient way to do the following:
Code:
syslist_ConvertToXML(listName, ByRef xml) {
list := syslist_Get(listName)
"
xml := ""
xpath(xml, "/" . listName . "[+1]/@version", "2.0")
loop,Parse,list,`n
{
fieldIndex := 1
fields := A_LoopField
type := removeValue(fields, "type")
removeValue(fields, "listName")
loop
{
StringGetPos, epos, fields, :
if epos = -1
break
name := SubStr(fields, 2, epos-1)
xvalue := removeValue(fields, name)
StartTime := A_TickCount
if (fieldIndex = 1) {
xpath(xml, "/" . listName . "/" . type . "[+1]/" . name . "[+1]/text()", xvalue)
} else {
xpath(xml, "/" . listName . "/" . type . "[last()]/" . name . "[+1]/text()", xvalue)
}
fieldIndex ++
log("xpath elapsed:" . A_TickCount - StartTime)
}
}
return xml
}
In the beginning of the process, the time elapsed is close to 0. At the end of the process, the time elapsed averages 100 milliseconds. The complete document contains roughly 600 lines.