This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes XML and Related Technologies and the fly likes Entity names and hex values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Entity names and hex values" Watch "Entity names and hex values" New topic

Entity names and hex values

Thomas Greene
Ranch Hand

Joined: Aug 09, 2004
Posts: 127
I have declared some entity references in my XML (may be external or internal). Say

<?xml version="1.0" encoding="ISO-8859-1"?>

<?xml-stylesheet type="text/xsl" href="sample.xsl"?>

<!DOCTYPE titlepackage [
<!ENTITY rdquo "”" >
<!ENTITY rdquor "“" >

<ID id="e"/>
<title> ”Know thyself.”</title>

Here I am using the entity names in XML and there hex values are mentioned in the DOCTYPE declaration.
I want to know is there any difference between using entity names (where entity values are specified in DOCTYPE) and directly using the hex values in the XML, as in the example below

<?xml version="1.0" encoding="ISO-8859-1"?>

<?xml-stylesheet type="text/xsl" href="sample.xsl"?>

<ID id="e"/>
<title> ”Know thyself.“</title>

Is there any advantage of using one over the other?
[ March 01, 2007: Message edited by: Thomas Greene ]
Paul Clapham

Joined: Oct 14, 2005
Posts: 19727

Well, the obvious advantage of putting the entities directly in the XML, as opposed to having an internal DTD, is that you don't have to go to the trouble of ensuring the internal DTD is in every single XML document that needs those characters.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Entity names and hex values
It's not a secret anymore!