private void parseMessage(Document messageDom) {
try {
// parse the XML document into a DOM
// Document messageDom = XMLParser.parse(messageXml);
Node dataSetNode = messageDom.getElementsByTagName("dataset").item(
0);
List<Node> dataSetNodeChildren = DOMUtil
.getChildElements(dataSetNode.getChildNodes());
List<DataEntry> results = new ArrayList<DataEntry>();
for (Node dataNode : dataSetNodeChildren) {
DataEntry dataEntry = new DataEntry();
NamedNodeMap dataNodeAttributes = dataNode.getAttributes();
Node valueNode = DOMUtil.getChildElements(
dataNode.getChildNodes()).get(0); // expected to have
// just one child‚
NamedNodeMap valueNodeAttributes = valueNode.getAttributes();
dataEntry.key = dataNodeAttributes.getNamedItem("key")
.getNodeValue();
dataEntry.java = dataNodeAttributes.getNamedItem("javaType")
.getNodeValue();
dataEntry.xsd = valueNodeAttributes.getNamedItem("xsi:type")
.getNodeValue();
List<Node> valueChildElements = DOMUtil
.getChildElements(valueNode.getChildNodes());
if (valueChildElements.isEmpty()
&& valueNode.hasChildNodes()
&& Node.TEXT_NODE == valueNode.getChildNodes().item(0)
.getNodeType()) {
dataEntry.value = valueNode.getFirstChild().getNodeValue();
} else {
// complex types or empty elements
dataEntry.value = "n/a";
}