<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>

<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.6980.72">
<TITLE>RE: [jdom-interest] Question about ElementScanner</TITLE>
</HEAD>
<BODY>
<DIV id=idOWAReplyText71819 dir=ltr>
<DIV dir=ltr><FONT face=Arial color=#000000 size=2>Hi All,</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>Is there a way I can ouput the XML string
off a Document, without the first line containing the encoding.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2>( The line with &lt;?xml version="1.0"
encoding="UTF-8"?&gt; )</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>Iam talking to a external system, which for
some reason does not want the encoding.</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr><FONT face=Arial size=2>Currently this is what I do</FONT></DIV>
<DIV dir=ltr><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV dir=ltr>&nbsp;public String toString()<BR>&nbsp;&nbsp; {<BR>&nbsp;&nbsp;
&nbsp;XMLOutputter outputter = new XMLOutputter();<BR>&nbsp;&nbsp; &nbsp;return
outputter.outputString(myDocument);<BR>&nbsp;&nbsp; }</DIV>
<DIV dir=ltr>&nbsp;</DIV>
<DIV dir=ltr>Regards</DIV>
<DIV dir=ltr>&nbsp;</DIV>
<DIV dir=ltr>Mahesh</DIV></DIV>
<DIV dir=ltr><BR>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> jdom-interest-bounces@jdom.org on behalf
of Michael Smith<BR><B>Sent:</B> Mon 3/28/2005 10:42 AM<BR><B>To:</B>
jdom-interest@jdom.org<BR><B>Subject:</B> RE: [jdom-interest] Question about
ElementScanner<BR></FONT><BR></DIV>
<DIV>
<P><FONT size=2>Thanks for all the responses to my question. I did finally get
this working<BR>using Xpath. I was avoiding an XSLT solution because I'd rather
do as much<BR>as I can in Java if possible (personal preference). I'm new to
JDOM, so just<BR>getting my sea legs as to where the boundaries are. I assumed
someone else<BR>had desired to do what I was seeking to do and&nbsp; had already
established a<BR>Java/JDOM solution.<BR><BR>-----Original Message-----<BR>From:
Phil Weighill-Smith [<A
href="mailto:phil.weighill-smith@volantis.com">mailto:phil.weighill-smith@volantis.com</A>]<BR>Sent:
Saturday, March 26, 2005 4:22 PM<BR>To: Phil Weighill-Smith; Michael Smith;
jdom-interest@jdom.org<BR>Subject: RE: [jdom-interest] Question about
ElementScanner<BR><BR>Which then made me think: why not use XSLT
instead?<BR><BR>Phil :n.<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-----Original Message-----<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From:
Phil Weighill-Smith<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent: Sat
26/03/2005 13:50<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To: Michael
Smith; jdom-interest@jdom.org<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Cc:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Subject: RE: [jdom-interest]
Question about
ElementScanner<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Try using XPath to select all elements you want to replace then<BR>manipulate
these elements via the JDOM
API.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
E.g. to find all elements called "x" anywhere in a document use the<BR>XPath
"//x", or to find all elements called "x" with an attribute "a" with<BR>the
value "example" you could use the XPath "//x[@a='example']". XPath is<BR>very
powerful for performing potentially conditional selection of
elements,<BR>attributes, text nodes etc. especially if you use the various axes
and<BR>built-in
functions.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Phil
:n)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -----Original
Message-----<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; From: Michael Smith [<A
href="mailto:mikesmi@nc.rr.com">mailto:mikesmi@nc.rr.com</A>]<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sent: Fri 25/03/2005
16:38<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; To:
jdom-interest@jdom.org<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Cc:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Subject: [jdom-interest] Question
about ElementScanner<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Hi
there,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I want to create a way to search
through XML documents and<BR>perform a search and replace on certain elements
regardless of their place<BR>in the hierarchy. I'm thinking ElementScanner is
useful here? If so, can<BR>someone point me to an example of its use. If not,
can you suggest<BR>another/better
way?<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Thanks,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Mike<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<BR><BR>_______________________________________________<BR>To
control your jdom-interest membership:<BR><A
href="http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com">http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com</A><BR></FONT></P></DIV>

</BODY>
</HTML>
<table><tr><td bgcolor=#ffffff><font color=#000000>This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient,  you are not authorized to read, print, retain, copy, disseminate,  distribute, or use this message or any part thereof. If you receive this  message in error, please notify the sender immediately and delete all  copies of this message.<br>
<br>
</font></td></tr></table>