<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Extracting ProcessingInstructions</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->

<P><SPAN LANG="fr"><FONT SIZE=2 FACE="Arial">Hi!</FONT></SPAN>

<BR><SPAN LANG="fr"><FONT SIZE=2 FACE="Arial">I'm new to JDOM and i use beta 8.</FONT></SPAN>

<BR><SPAN LANG="fr"><FONT SIZE=2 FACE="Arial">My problem is that i would like to extract the first line of my XML document (&lt;? xml etc... ?&gt;).</FONT></SPAN>

<BR><SPAN LANG="fr"><FONT SIZE=2 FACE="Arial">So i use the getContent() method on my JDOM Document but i just get one element representing the root element and nothing more...</FONT></SPAN></P>

<P><SPAN LANG="fr"><FONT SIZE=2 FACE="Arial">Here is my piece of code :</FONT></SPAN>
</P>

<P><SPAN LANG="fr">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">java.util.List list = theDoc.getContent();</FONT></SPAN>

<BR><SPAN LANG="fr">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">java.util.ListIterator iter = list.listIterator();</FONT></SPAN>

<BR><SPAN LANG="fr">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">while (iter.hasNext())</FONT></SPAN>

<BR><SPAN LANG="fr">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">{</FONT></SPAN>

<BR><SPAN LANG="fr">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">Object obj = iter.next();</FONT></SPAN>

<BR><SPAN LANG="fr">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">if (obj instanceof org.jdom.ProcessingInstruction)</FONT></SPAN>

<BR><SPAN LANG="fr">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">{</FONT></SPAN>

<BR><SPAN LANG="fr">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">// do things...</FONT></SPAN>

<BR><SPAN LANG="fr">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">break;</FONT></SPAN>

<BR><SPAN LANG="fr">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">}</FONT></SPAN>

<BR><SPAN LANG="fr">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT SIZE=2 FACE="Arial">}</FONT></SPAN>

<BR><SPAN LANG="fr"><FONT SIZE=2 FACE="Arial">I tried to put comments and i could extract them. It's just like if the parsing operation delete the only line i would like to have ... so frustrating...</FONT></SPAN></P>

<P><SPAN LANG="fr"><FONT SIZE=2 FACE="Arial">Hope one could help because i read Jason's response on nearly the same question but... it doesn't work for me.</FONT></SPAN>
</P>

<P><SPAN LANG="fr"><FONT SIZE=2 FACE="Arial">Francois</FONT></SPAN>
</P>

</BODY>
</HTML>