[jdom-interest] Special characters in XML?

philip.nelson at omniresources.com philip.nelson at omniresources.com
Thu Mar 15 20:43:45 PST 2001

 &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

-----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
symbol) in my XML string and I'm having difficulties.  It is updated
JDOM and stored in my database just fine using JDOM, but when it tries
instantiate the document object from the string I get the following

org.jdom.JDOMException: Error on line 2: The entity "reg" was
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
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.


To control your jdom-interest membership:

More information about the jdom-interest mailing list