Skip to Content.
Sympa Menu

xom-interest - [XOM-interest] (no subject)

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Jason McKendry" <jason.mckendry AT namelessoperation.com>
  • To: <xom-interest AT lists.ibiblio.org>
  • Subject: [XOM-interest] (no subject)
  • Date: Thu, 30 Sep 2010 02:48:45 -0700

Hello everyone,

I have built an application on top of XOM, and the last thing I haven't been
able to iron out over the past few weeks has been a problem with character
references and escape sequences to represent non-standard characters in my
XML data files. I found information about how to use the xsl:output tag to
add a character map, but since the result of each transformation is a XOM
Nodes object, the xsl:output tag is never processed. I had to solve a
similar problem using the DocType object, but I wasn't having any luck
figuring out how to use that knowledge to solve this problem.

So far the best I've been able to come up with is either a way of having the
character reference in my XML/XSL resolve to the character in the HTML source
(which of course displays garbage in the browser), or to have something like
&amp;copy; in the source, which we know renders in the browser as &copy;. I
have only been able to find advice that uses the xsl:output tag at this point.

My (hopefully temporary) workaround has been to cobble together some
JavaScript that looks for custom tags in the HTML source via body onload, and
then inserts the character with a unicode reference based on that location.
It's okay for now, but my client wants to expand to multi-lingual versions of
their site, and that will create a maintenance nightmare. Aside from that, I
feel as though the XML should be where the actual data lives, not some
pointer for a piece of client-side script to look for when I don't even have
any assurance that it will always fire.

I've thought about going the other way, and having a custom piece of Java
manipulate the output as text files, but that seems kludgy to me, too, and
similarly painful to maintain.

I'd be very grateful for any guidance on where to look to solve this problem.
Any advice or suggestions would be very welcome. I'm sure in all this time
I'm not the only person to run into this!

Thank you,

Jason McKendry
namelessOperation();
>From mike AT saxonica.com Thu Sep 30 06:18:42 2010
Return-Path: <mike AT saxonica.com>
X-Original-To: xom-interest AT lists.ibiblio.org
Delivered-To: xom-interest AT lists.ibiblio.org
Received: by lists.ibiblio.org (Postfix, from userid 3002)
id BA8E64C043; Thu, 30 Sep 2010 06:18:42 -0400 (EDT)
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on malecky
X-Spam-Level:
X-Spam-Status: No, score=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW
autolearn=disabled version=3.3.1
Received: from relay03.mail.uk1.eechost.net (relay01.mail.uk1.eechost.net
[217.69.40.69])
by lists.ibiblio.org (Postfix) with ESMTP id 8A2894C03C
for <xom-interest AT lists.ibiblio.org>;
Thu, 30 Sep 2010 06:18:40 -0400 (EDT)
Received: from [82.152.109.199] (helo=[192.168.0.100])
by relay03.mail.uk1.eechost.net with esmtpa (Exim 4.68)
(envelope-from <mike AT saxonica.com>) id 1P1GDk-0005tB-89
for xom-interest AT lists.ibiblio.org; Thu, 30 Sep 2010 11:18:36 +0100
Message-ID: <4CA463FF.5090301 AT saxonica.com>
Date: Thu, 30 Sep 2010 11:18:39 +0100
From: Michael Kay <mike AT saxonica.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB;
rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4
MIME-Version: 1.0
To: xom-interest AT lists.ibiblio.org
References: <89C39051B1084808A7500EB2DD0591F0@MegaLappy>
In-Reply-To: <89C39051B1084808A7500EB2DD0591F0@MegaLappy>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Auth-Info: mike AT saxonica.com (plain)
Subject: Re: [XOM-interest] (no subject)
X-BeenThere: xom-interest AT lists.ibiblio.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: XOM API for Processing XML with Java
<xom-interest AT lists.ibiblio.org>
List-Id: XOM API for Processing XML with Java <xom-interest.lists.ibiblio.org>
List-Unsubscribe: <http://lists.ibiblio.org/mailman/options/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=unsubscribe>
List-Archive: <https://lists.ibiblio.org/sympa/arc/xom-interest>
List-Post: <mailto:xom-interest AT lists.ibiblio.org>
List-Help: <mailto:sympa AT lists.ibiblio.org?subject=HELP>
List-Subscribe: <http://lists.ibiblio.org/mailman/listinfo/xom-interest>,
<mailto:xom-interest-request AT lists.ibiblio.org?subject=subscribe>
X-List-Received-Date: Thu, 30 Sep 2010 10:18:42 -0000

I think you're confused in your requirements.

XOM is a tree model, an abstract view of an XML document. In the tree
view of XML, characters are simply characters (things that correspond
one-to-one with unicode codepoints). The copyright symbol is one
character, one codepoint, and it is represented as such; you aren't
concerned with expansions such as &copy; because those don't exist in
the tree view, they are only devices for serializing the XML within the
constraints of a restricted character repertoire. Creating entity or
character references is something that should only happen when you
serialize from the tree model to lexical XML, you should never attempt
to have such references present in the tree itself.

Michael Kay
Saxonica


On 30/09/2010 10:48 AM, Jason McKendry wrote:
> Hello everyone,
>
> I have built an application on top of XOM, and the last thing I haven't
> been able to iron out over the past few weeks has been a problem with
> character references and escape sequences to represent non-standard
> characters in my XML data files. I found information about how to use the
> xsl:output tag to add a character map, but since the result of each
> transformation is a XOM Nodes object, the xsl:output tag is never
> processed. I had to solve a similar problem using the DocType object, but
> I wasn't having any luck figuring out how to use that knowledge to solve
> this problem.
>
> So far the best I've been able to come up with is either a way of having
> the character reference in my XML/XSL resolve to the character in the HTML
> source (which of course displays garbage in the browser), or to have
> something like&amp;copy; in the source, which we know renders in the
> browser as&copy;. I have only been able to find advice that uses the
> xsl:output tag at this point.
>
> My (hopefully temporary) workaround has been to cobble together some
> JavaScript that looks for custom tags in the HTML source via body onload,
> and then inserts the character with a unicode reference based on that
> location. It's okay for now, but my client wants to expand to
> multi-lingual versions of their site, and that will create a maintenance
> nightmare. Aside from that, I feel as though the XML should be where the
> actual data lives, not some pointer for a piece of client-side script to
> look for when I don't even have any assurance that it will always fire.
>
> I've thought about going the other way, and having a custom piece of Java
> manipulate the output as text files, but that seems kludgy to me, too, and
> similarly painful to maintain.
>
> I'd be very grateful for any guidance on where to look to solve this
> problem. Any advice or suggestions would be very welcome. I'm sure in all
> this time I'm not the only person to run into this!
>
> Thank you,
>
> Jason McKendry
> namelessOperation();
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>





Archive powered by MHonArc 2.6.24.

Top of Page