[jdom-interest] jdom build a JAva Object with a file XML with morethan one item

Phil Weighill-Smith phil.weighill-smith at volantis.com
Wed Jan 26 13:12:32 PST 2005

Using JDOM you can read this XML file (see http://www.jdom.org/docs/apidocs/org/jdom/input/SAXBuilder.html) into a JDOM Document (see http://www.jdom.org/docs/apidocs/org/jdom/Document.html). This document will have a root node called "applications" (see http://www.jdom.org/docs/apidocs/org/jdom/Document.html#getRootElement()). This root node will have two child elements, both called "application" (see http://www.jdom.org/docs/apidocs/org/jdom/Element.html).
Either using the JDOM API (to which these links take you) or using the JDOM XPath API (see http://www.jdom.org/docs/apidocs/org/jdom/xpath/XPath.html) you can traverse this DOM to read the data (attributes, child elements etc.).
Hope that helps,
Phil :n)

	-----Original Message----- 
	From: Christian Avril [mailto:christian.avril at dpma.finances.gouv.fr] 
	Sent: Wed 26/01/2005 18:17 
	To: jdom-interest at jdom.org 
	Subject: [jdom-interest] jdom build a JAva Object with a file XML with morethan one item
	Hello , 
	Have You Please an example with an XML File and more than one item.
	I would build this file in a Java Object. But there are more than one "application"
	<?xml version="1.0" encoding="utf-8"?>
	<applications  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="applications.xsd">
	   <application key="appli1">
	   <application key="appli1">
	   <application key="appli2">

More information about the jdom-interest mailing list