Dehydrate (serialize) as XML

Added by iNTERFACEWARE

How to dehydrate (serialize) raw XML data, this can be useful for storing in a databases

Source Code
local Vmd = 'example/demo.vmd'

function main(Data)
   local H = hl7.parse{vmd=Vmd,data=Data}
   local D = MyTemplate()

   D.data.ssn = H.PID[19]
   D.data.dob = H.PID[7][1]
   D.data.ascension_num = H.PID[3][1][1]

   local SerializedXml = D:S()

   D = DehydrateXml(SerializedXml)
   trace(D.data.ssn:nodeValue())
end

function MyTemplate()
   return xml.parse{data="<data ssn='' dob='' ascension_num=''/>"}
end

function DehydrateXml(Xml)
   return xml.parse{data=Xml}
end
Description
How to dehydrate (serialize) raw XML data, this can be useful for storing in a databases