...
Info |
---|
The default xml node and xml module provide limited functionalities to either parse or create XML node. In additional to https://help.interfaceware.com/v6/xml-channel. The XMLUtils.lua module extends further to the following capabilities: |
XMLUtils.lua
Expand | |||||
---|---|---|---|---|---|
| |||||
|
...
Select child node from the root XML node based on the XML path. Unlike traditional xml node drill down with nil validation, you can easily use select function to find the sub child of xml node.
REQUIRED PARAMETERS
XMLNode: the root of XML node
path: xml child node path
required: If 'required' is false and 'thisNode' is nil, the function returns nothing and exitstrue, the path must be exist otherwise throw “
required path not found
“ error.
RETURNS
The child node tree
...
Select child node from the root XML node based on the XML path.
REQUIRED PARAMETERS
XMLNode: the root of XML node
path: xml child node path
required: If 'required' is false and 'thisNode' is nil, the function returns nothing and exits.
...
Code Block |
---|
local patientXML = recordXMLchargeTransaction:selectnumber("chargeTransaction/patientbatchId", true) .. '-' .. chargeTransaction:number("syncId") |
Node.text()
USAGE
Select child node from Keep the root XML node based on XML element but empty the XML pathelement Text value
REQUIRED PARAMETERS
XMLNode: the root of XML node
path: xml child node path
required: If 'required' is false and 'thisNode' is nil, the function returns nothing and exits.
...
The child node tree
SAMPLE CODE
Code Block |
---|
local patientXMLPID[3][1] = recordXMLpatient:selecttext("chargeTransaction/patient", truemedicalRecordNumber") |
Node.children()
USAGE
Select child node from the root XML node based on the XML path
...
Code Block |
---|
local patientXML = recordXML:select("chargeTransaction/patient", true) |
Node.firstChild()
USAGE
Select child node from the root XML node based on the XML pathSearch for the first XML element that meets to criteria passed into the function.
REQUIRED PARAMETERS
XMLNodeElement Name: The name of the root of XML nodeelement.
path: xml child node path
required: If 'required' is false and 'thisNode' is nil, the function returns nothing and exits.
RETURNS
The child node tree
SAMPLE CODE
Code Block |
---|
local patientXML = recordXML:select("chargeTransaction/patient", true) |
Node.removeText()
USAGE
Select child node from the root XML node based on the XML path
REQUIRED PARAMETERS
XMLNode: the root of XML node
path: xml child node path
required: If 'required' is false and 'thisNode' is nil, the function returns nothing and exits.
RETURNS
The child node treeAttribute Name: The attribute name that you want to be found. Make sure to include the “@” prefix.
Attribute Value: The attribute value attached to the attribute name to be found.
RETURNS
The first match for the XML element.
SAMPLE CODE
Code Block |
---|
local patientXMLfirstElement = recordXMLXMLRecord:selectfirstChild("chargeTransaction/patient", trueElement", "@AttributeName", "AttributeValue") |
Node.removeText()
USAGE
Keep the XML element but empty the XML element Text value
REQUIRED PARAMETERS
None
RETURNS
Empty
SAMPLE CODE
Code Block |
---|
recordXML.element:removeText() |