Home » XML Parser
The XML Parser allows you to transform an XML-string into a queryable object, XPathNavigator.
var xmlObj = XML.parse('<xml><element attribute="value1" /><element attribute="value2" /></xml>');
This object exposes properties and methods to query an XML element easily using X-Path.
https://www.w3schools.com/xml/xpath_syntax.asp
The XML object’s value. If the object is an element, the value is the text inside between start and end tags or the inner XML content if applicable. If the object is an attribute, the value is the attribute’s value.
var firstElement = xmlObj.selectFirst('/xml/element/@attribute');
var value = firstElement.value;
// The value should be equal to "value1".
Returns the first occurrence of the provided X-Path, or undefined if there are no occurrences.
var element = xmlObj.selectFirst('/xml/element');
// Should return the first <element> inside the <xml> node.
Returns an array with all occurrences of the provided X-Path, or an empty array if no occurrences.
var elements = xmlObj.select('/xml/element');
// Should return an array with all <element> inside the <xml> node.
Returns a string representation of the XML element.
var element = xmlObj.selectFirst('/xml/element');
var value = element.toString()
// The value should be equal to "<element attribute="value1" />".
NORTH AMERICA: +1 (877)-872-0027
WORLD: 1-418-872-4000
EMAIL: info@caristix.com
ASIA-PACIFIC
DENIS CANTIN
T: +61418441388
denis.cantin@caristix.com
NORTH AMERICA & EUROPE
JEAN-LUC MORIN
T: 418 872-4000
jeanluc.morin@caristix.com
HL7® / FHIR® are a registered trademarks of Health Level Seven International. The use of this trademark does not constitute an endorsement by HL7.