Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] What's an elegant way to write symbolic entities

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Michael Kay <mike AT saxonica.com>
  • To: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] What's an elegant way to write symbolic entities
  • Date: Sun, 09 Jan 2011 16:58:25 +0000

On 09/01/2011 16:44, David Collier-Brown wrote:
I'm starting a mini-project to get some input documents into a good,
editable xml.
One of the things I desire to do is write entities in their symbolic
form, so that a
non-breaking space will be written as&nbsp; and e-acute as&eacute;

This is in principle doable by sending the output not through a
serializer, but instead
a through an xslt processor that uses a list of character-maps which in
turn enumerate
the entire list of entities from my DTD.
However, thus looks a lot like "going via Snarey's Corners", a term
from my
childhood symbolizing going insanely far out of one's way to do something.

Is there a simple, straightforward and perhaps even elegant way
to produce output containing symbolic entities?

--dave


You could write a Java Writer that filters the output stream by looking at each character and converting it accordingly - so long as you know that special characters won't occur in element/attribute names, and so long as you don't care what happens in comments and processing instructions.

Michael Kay
Saxonica




Archive powered by MHonArc 2.6.24.

Top of Page