<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2800.1479" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hello Phil, </FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Thanks </FONT></DIV>
<DIV><FONT face=Arial size=2>It's right, I can read the apidocs and that
helps.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>In my case, I think it's better to use a DOM, and
not a SAX.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>And then, retrieve each Element and Values
</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>For example, build into a Document , and not only
valid them , then parse it</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial
size=2>
//
builder.build(fichierxml);<BR>
Document doc =
builder.build(fichierxml);<BR>
Element applications =
doc.getRootElement();<BR>
Iterator itr =
(applications.getChildren()).iterator();<BR>
while (itr.hasNext())
{<BR>
Element app = (Element) itr.next();</FONT></DIV>
<DIV><FONT face=Arial
size=2>
.../...</FONT></DIV>
<DIV><FONT face=Arial
size=2>
log.info(app.getAttribute("name").getValue());</FONT></DIV>
<DIV><FONT face=Arial
size=2>
.../...</FONT></DIV>
<DIV><FONT face=Arial
size=2>
}</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=phil.weighill-smith@volantis.com
href="mailto:phil.weighill-smith@volantis.com">Phil Weighill-Smith</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=christian.avril@dpma.finances.gouv.fr
href="mailto:christian.avril@dpma.finances.gouv.fr">Christian Avril</A> ; <A
title=jdom-interest@jdom.org
href="mailto:jdom-interest@jdom.org">jdom-interest@jdom.org</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, January 26, 2005 10:12
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [jdom-interest] jdom build a
JAva Object with a file XML with morethan one item</DIV>
<DIV><BR></DIV>Using JDOM you can read this XML file (see <A
href="http://www.jdom.org/docs/apidocs/org/jdom/input/SAXBuilder.html">http://www.jdom.org/docs/apidocs/org/jdom/input/SAXBuilder.html</A>)
into a JDOM Document (see <A
href="http://www.jdom.org/docs/apidocs/org/jdom/Document.html">http://www.jdom.org/docs/apidocs/org/jdom/Document.html</A>).
This document will have a root node called "applications" (see <A
href="http://www.jdom.org/docs/apidocs/org/jdom/Document.html#getRootElement">http://www.jdom.org/docs/apidocs/org/jdom/Document.html#getRootElement</A>()).
This root node will have two child elements, both called "application" (see <A
href="http://www.jdom.org/docs/apidocs/org/jdom/Element.html">http://www.jdom.org/docs/apidocs/org/jdom/Element.html</A>).<BR> <BR>Either
using the JDOM API (to which these links take you) or using the JDOM XPath API
(see <A
href="http://www.jdom.org/docs/apidocs/org/jdom/xpath/XPath.html">http://www.jdom.org/docs/apidocs/org/jdom/xpath/XPath.html</A>)
you can traverse this DOM to read the data (attributes, child elements
etc.).<BR> <BR>Hope that helps,<BR> <BR>Phil
:n)<BR><BR>-----Original Message----- <BR>From: Christian Avril
[mailto:christian.avril@dpma.finances.gouv.fr] <BR>Sent: Wed 26/01/2005 18:17
<BR>To: <A href="mailto:jdom-interest@jdom.org">jdom-interest@jdom.org</A>
<BR>Cc: <BR>Subject: [jdom-interest] jdom build a JAva Object with a file XML
with morethan one item<BR><BR><BR>Hello , <BR><BR>Have You Please an example
with an XML File and more than one item.<BR>I would build this file in a Java
Object. But there are more than one "application"<BR>See<BR><?xml
version="1.0" encoding="utf-8"?><BR><applications xmlns:xsi="<A
href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</A>"
xsi:noNamespaceSchemaLocation="applications.xsd"><BR>
<application key="appli1"><BR>
<rule>rule_a</rule><BR>
<role>admin</role><BR>
<permission>0</permission><BR>
<population>allperson<BR>
<filter>ou=ldapfilter123</filter><BR>
</population><BR> </application><BR>
<application key="appli1"><BR>
<rule>rule_u</rule><BR>
<role>user</role><BR>
<permission>1</permission><BR>
<population>users<BR>
<filter>ou=ldapfilter456</filter><BR>
</population><BR> </application><BR>
<application key="appli2"><BR>
<rule>rule_a</rule><BR>
<role>admin</role><BR>
<permission>2</permission><BR>
<population>allperson<BR>
<filter>ou=ldapfilter789</filter><BR>
</population><BR>
</application><BR></applications><BR><BR>Thanks
<BR><BR>Chris<BR><BR><BR></BLOCKQUOTE></BODY></HTML>