[jdom-interest] Output a XML String without the encoding

Trikannad, Mahesh mahesh.trikannad at capgemini.com
Mon Mar 28 10:50:06 PST 2005

Hi All,

Is there a way I can ouput the XML string off a Document, without the first line containing the encoding.
( The line with <?xml version="1.0" encoding="UTF-8"?> )

Iam talking to a external system, which for some reason does not want the encoding.

Currently this is what I do

 public String toString()
    XMLOutputter outputter = new XMLOutputter();
    return outputter.outputString(myDocument);




From: jdom-interest-bounces at jdom.org on behalf of Michael Smith
Sent: Mon 3/28/2005 10:42 AM
To: jdom-interest at jdom.org
Subject: RE: [jdom-interest] Question about ElementScanner

Thanks for all the responses to my question. I did finally get this working
using Xpath. I was avoiding an XSLT solution because I'd rather do as much
as I can in Java if possible (personal preference). I'm new to JDOM, so just
getting my sea legs as to where the boundaries are. I assumed someone else
had desired to do what I was seeking to do and  had already established a
Java/JDOM solution.

-----Original Message-----
From: Phil Weighill-Smith [mailto:phil.weighill-smith at volantis.com]
Sent: Saturday, March 26, 2005 4:22 PM
To: Phil Weighill-Smith; Michael Smith; jdom-interest at jdom.org
Subject: RE: [jdom-interest] Question about ElementScanner

Which then made me think: why not use XSLT instead?

Phil :n.

        -----Original Message-----
        From: Phil Weighill-Smith
        Sent: Sat 26/03/2005 13:50
        To: Michael Smith; jdom-interest at jdom.org
        Subject: RE: [jdom-interest] Question about ElementScanner

        Try using XPath to select all elements you want to replace then
manipulate these elements via the JDOM API.
        E.g. to find all elements called "x" anywhere in a document use the
XPath "//x", or to find all elements called "x" with an attribute "a" with
the value "example" you could use the XPath "//x[@a='example']". XPath is
very powerful for performing potentially conditional selection of elements,
attributes, text nodes etc. especially if you use the various axes and
built-in functions.
        Phil :n)
                -----Original Message-----
                From: Michael Smith [mailto:mikesmi at nc.rr.com]
                Sent: Fri 25/03/2005 16:38
                To: jdom-interest at jdom.org
                Subject: [jdom-interest] Question about ElementScanner
                Hi there,
                I want to create a way to search through XML documents and
perform a search and replace on certain elements regardless of their place
in the hierarchy. I'm thinking ElementScanner is useful here? If so, can
someone point me to an example of its use. If not, can you suggest
another/better way?

To control your jdom-interest membership:

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.jdom.org/pipermail/jdom-interest/attachments/20050328/b083dfef/attachment.htm

More information about the jdom-interest mailing list