[jdom-interest] Special characters in XML?

Gary Bentley gb at opengroup.org
Fri Mar 16 02:15:06 PST 2001


As a point of interest, JDOM seems to have a number of entities built in,
does anyone have a complete list?  I know that < 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




More information about the jdom-interest mailing list