[jdom-interest] How to get the XML Decl with JDOM?
Alex Rosen
arosen at silverstream.com
Mon Oct 29 08:12:20 PST 2001
(1) Check the JDOM FAQ for the current answer.
However, is this answer still completely true? It looks like the SAX2
"extensions" provides this info now:
http://sax.sourceforge.net/apidoc/org/xml/sax/ext/Locator2.html. Anyone know
anything about these extensions, and which parsers implement them?
(2) It's called something like "http://.../allow-java-encodings". Check the
"features" list of Xerces. When reading in an XML file, JDOM relies on
whatever the underlying parser does. So if the underlying parser is Xerces,
and you set this feature, then it should work fine.
(To clarify, I think the major parsers (Xerces and Crimson) always support
all the encodings that Java supports, plus some more. What this feature
enables is the Java *names* of these encodings. E.g. the real name of UTF-8
encoding is "UTF-8", but Java calls it "UTF8". Turning on this feature will
let you parse a document that says encoding="UTF8", rather than getting an
unsupported encoding exception. Crimson might also have a similar feature.)
Alex
> -----Original Message-----
> From: jdom-interest-admin at jdom.org
> [mailto:jdom-interest-admin at jdom.org]On Behalf Of Fred Clewis
> Sent: Sunday, October 28, 2001 2:11 PM
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] How to get the XML Decl with JDOM?
>
>
> I'm trying to fix an application to output in the same encoding it
> input. I see from other posts that I should setEncoding on my
> XMLOutputter and associated writer. What I'm trying to figure out is
> how to get the encoding value out of my input xml. getContent() does
> not give you the first PI (xml decl). What is the JDOM method to give
> me either the encoding value or the entire xml decl PI?
>
> Also, this forum advised me earlier that:
> "Xerces has a toggle to tell it to handle all Java-supported
> encodings"
> Does anyone know where this might be and of it's usefulness
> when wrapped
> with JDOM?
>
> thanks for any ideas, and thanks for JDOM,
>
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/yo
> uraddr at yourhost.com
More information about the jdom-interest
mailing list