xom-interest AT lists.ibiblio.org
Subject: XOM API for Processing XML with Java
List archive
- From: Luca Passani <passani AT eunet.no>
- To: 'xom-interest' <xom-interest AT lists.ibiblio.org>
- Subject: Re: [XOM-interest] entity in attribute value
- Date: Wed, 14 Jan 2009 01:22:36 +0100
I think we agree. The problem was my misunderstanding/ignorance of how parser works. For some reason which I never quite understood, XML keeps surprising me after all these years. Not referring to this case specifically, but every time I think I have understood the XML basics, something weird will come up and show me that I had not understood properly. Not really the "simple" standard it was supposed to be, but I don't want to digress, since it was my error.
Thanks
Luca
Benson Margulies wrote:
Luca,
Nothing in the XML standard has changed since 2002. The XML standard always
stated very clearly how entities work. The fact that XML parsers have become
progressively more capable of implementing the standard is another story.
The rule is really simple. If you want to put a string into XML, you have to
escape & and < as & and < In PCDATA, you can use CDATA. In attribute
values, it's the &-entities, period.
Plain old XML doesn't know what € is unless you tell it so with an
entity definition. If your data has € in it (perhaps it's HTML you are
carting around in XML) then, sure enough, &euro; is what you would write
in the xml file. And out of a parser API will come "€".
On 1/13/09 6:49 PM, "Luca Passani" <passani AT eunet.no> wrote:
Michael Kay wrote:
You can write it as &euro; if you really want to. But why on earth wouldbecause, in this framework (WURFL), an XML file is the core of a simple
you want to use something that looks just like an entity reference but isn't
one?
DB to store strings. Usually those strings are not entities, but
yesterday I happened to need to store a string which looked identical to
an XML entity.
Every technology sucks if you misuse it.what should I have done in 2002 when I started the project? decide that
XML was not good for me because maybe one day this XML file may have to
contain a string which could be confused with an XML entity?
I've got a brand new digital cameraWURFL is a very successful project in its field. Thousands of developers
and it's no good at hammering nails. Perhaps the problem is with the user,
not with the technology?
around the planet have been able to download it and use it out of the
box without much trouble. Anyway, the problem is solved. I now know how
to escape those "things". I always knew that & escapes &, but for
some reason I was assuming that the XML parser would return "&euro;"
as "&euro;" (and not as "€" which is what I want).
Please observe that declaring the entity is not possible, because the
WURFL model is such that a developer can throw any kind of property
inside WURFL without changing anything else, and legitimately expect to
find it at a later stage.
Thank you for your interest in the problem.
Luca
-
Re: [XOM-interest] entity in attribute value
, (continued)
-
Re: [XOM-interest] entity in attribute value,
Tatu Saloranta, 01/12/2009
- Re: [XOM-interest] entity in attribute value, Luca Passani, 01/12/2009
-
Re: [XOM-interest] entity in attribute value,
Michael Kay, 01/13/2009
- Re: [XOM-interest] entity in attribute value, Luca Passani, 01/13/2009
-
Re: [XOM-interest] entity in attribute value,
Michael Kay, 01/13/2009
-
Re: [XOM-interest] entity in attribute value,
Tatu Saloranta, 01/14/2009
-
Re: [XOM-interest] entity in attribute value,
Luca Passani, 01/14/2009
-
Re: [XOM-interest] entity in attribute value,
Tatu Saloranta, 01/14/2009
-
Re: [XOM-interest] entity in attribute value,
Luca Passani, 01/15/2009
- Re: [XOM-interest] entity in attribute value, Tatu Saloranta, 01/15/2009
-
Re: [XOM-interest] entity in attribute value,
Luca Passani, 01/15/2009
-
Re: [XOM-interest] entity in attribute value,
Tatu Saloranta, 01/14/2009
-
Re: [XOM-interest] entity in attribute value,
Luca Passani, 01/14/2009
-
Re: [XOM-interest] entity in attribute value,
Tatu Saloranta, 01/14/2009
- Re: [XOM-interest] entity in attribute value, Luca Passani, 01/13/2009
-
Re: [XOM-interest] entity in attribute value,
Tatu Saloranta, 01/12/2009
Archive powered by MHonArc 2.6.24.