Get the value of a node

Added by iNTERFACEWARE

Use node.nodeValue() to get the value of a leaf node, works for all node types

Source Code
   local Msg, Name = hl7.parse{vmd='example/demo.vmd', data=Data}

   -- get the value of a leaf node (surname)
   local name = Msg.PID[5][1][1][1]:nodeValue()
   --> "Surname"

   -- get the value of a non-leaf node (name)
   local name = Msg.PID[5][1][1]:nodeValue()
   --> ERROR: Branch nodes do not have values.

   -- best to check for leaf node first
   if Msg.PID[5][1][1]:isLeaf() then
      local name = Msg.PID[5][1][1]:nodeValue()
      --> nothing returned as not executed
   end
Description
Use node.nodeValue() to get the value of a leaf node, works for all node types