Ampersands in XML (was: UTF-8 editing problems with GEdit)
Paul M. Bucalo
linuxuser at pmbenterprises.com
Wed Apr 28 10:29:03 UTC 2004
On Tue, 2004-04-27 at 21:32, BjÃ¶rn Persson wrote:
> Paul M. Bucalo wrote:
> > I believe the problem was the use
> > one or more illegal character entries (like adding "&" to a title) and
> > that was causing it to fail. I seem to recall that you need to precede
> > each of these with an "\" to keep it from being interpreted, just like
> > at a BASH console.
> In XML and HTML (and I would guess all sorts of SGML), ampersand starts
> an entity reference (which ends with a semicolon). If you want a literal
> ampersand you must write it as "&", that is, an entity reference
> that references the ampersand entity. Likewise, if you want a less-than
> sign you can't write just "<", because that starts a tag, so you write
> it as "<".
The problem came about because I assumed that whatever was located
within the quotes following a tag was considered literal output (a menu
title) instead of interpreted. It never occurred to me that I had to
markup special characters within the quotes. My bad.
I should have remembered "&" was necessary, too, once I realized the
mistake. XML is similar enough to HTML that it should have registered. A
double "my bad".
At least I have my XFce desktop menu shaping up the way I want it.
Thanks for your help.
More information about the users