Home Analytics DevShare
The community of Analytics developers are invited to follow and participate in the developer network.
OpenText technical experts collaborate with supported customers and partners in the Magellan product area.

Parse XML from Database Field in BIRT Report

VirgilVirgil AdministratorEM admin
edited June 26, 2013 in DevShare
This example selects a String of XML from a database field, and then parses that string into several fields for the report. The code in this example is found in the computed columns of the Data Set as well as an expression of a data element and looks like the code below.<br />
<br />
Javascript code to parse the XML:
importPackage(Packages.org.apache.xerces.parsers);
importPackage(Packages.org.xml.sax);
importPackage(Packages.java.io);

var parser = new DOMParser();
parser.parse(new InputSource(new StringReader(dataSetRow&#91;"student_property"])));
var nodelist = parser.getDocument().getElementsByTagName('firstname');
var entry = nodelist.item(0).getFirstChild().getNodeValue();

entry;
<br />
This example was created with BIRT 2.2

Virgil Dodson
OpenText Analytics Developer Community
https://forums.opentext.com/forums/categories/analytics

Sign In or Register to comment.