[jdom-interest] Special characters in XML?

Falk Fraikin fraikin at informatik.tu-darmstadt.de
Fri Mar 16 04:12:46 PST 2001


Just have a look at the two methods 'escapeAttributeEntities' and
'escapeElementEntities' and their corresponding documentation in
XMLOutputter. This should answer your question more precisely...

Rgds.

Falk

-----Ursprüngliche Nachricht-----
Von: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]Im Auftrag von Gary Bentley
Gesendet: Freitag, 16. März 2001 12:26
An: Falk Fraikin; jdom-interest at jdom.org
Betreff: RE: [jdom-interest] Special characters in XML?


That's partly it...I am looking for the characters that I cannot use as
content in my XML documents...i.e. the ones I have to replace with entities!
I know that I have to replace < with &lt;, does the outputter also convert >
as well???

Cheers,

G.

-----Original Message-----
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of Falk Fraikin
Sent: Friday, March 16, 2001 11:02 AM
To: 'Gary Bentley'; jdom-interest at jdom.org
Subject: AW: [jdom-interest] Special characters in XML?


Hi Gary,

I'm not so sure what you mean when you write "built in", but XMLOutputter
converts the following charcters to their corresponding entity reference (as
specified by XML 1.0):

 '<' = "&lt;";
 '>' = "&gt;";
 '\'' = "&apos;";
 '\"' = "&quot;";
 '&' = "&amp;";

I hope that this is, what you asked for.

Regards,

Falk Fraikin

-----Urspr|ngliche Nachricht-----
Von: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]Im Auftrag von Gary Bentley
Gesendet: Freitag, 16. Mdrz 2001 11:15
An: jdom-interest at jdom.org
Betreff: RE: [jdom-interest] Special characters in XML?


As a point of interest, JDOM seems to have a number of entities built in,
does anyone have a complete list?  I know that &lt; is built in for obvious
reasons...

G.

-----Original Message-----
From: jdom-interest-admin at jdom.org
[mailto:jdom-interest-admin at jdom.org]On Behalf Of
philip.nelson at omniresources.com
Sent: Friday, March 16, 2001 4:44 AM
To: jdom-interest at jdom.org
Subject: RE: [jdom-interest] Special characters in XML?


 &reg is an entity and you have to declare these entities before they are
used.  *maybe* you confusing this entity with a similar idea in html where
certain entities are predeclared.  Look into doctypes and you'll have your
answer.

-----Original Message-----
From: David M. Goudreau
To: JDOM-Interest
Sent: 3/15/01 7:53 PM
Subject: [jdom-interest] Special characters in XML?

I'm trying to store special characters such as . (the registered
trademark
symbol) in my XML string and I'm having difficulties.  It is updated
through
JDOM and stored in my database just fine using JDOM, but when it tries
to
instantiate the document object from the string I get the following
error:

org.jdom.JDOMException: Error on line 2: The entity "reg" was
referenced,
but not declared.
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:348)
        at org.jdom.input.SAXBuilder.build(SAXBuilder.java:440)


The XML that causes the problem is:

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE root><root
sub_id="84"><folder name="tester" cdate="3/15/01" id="f_272" /><folder
name="&reg;" cdate="3/15/01" id="f_273" /></root>


Is there an easy way to handle special characters?  I would think this
conversion would be automatic depending on the encoding you use.  Do I
need
to use a different encoding?  What's the best way to handle special
characters?  Or do I need to create a DTD to define the "reg" entity?
Thanks in advance.


-dmg

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@you
rhost.com
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com

_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com




More information about the jdom-interest mailing list