OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: escaping characters

[ Lists Home | Date Index | Thread Index ]
  • From: Michael Brennan <Michael_Brennan@Allegis.com>
  • To: 'James Gray' <james.gray@buildpoint.com>, xml-dev@lists.xml.org
  • Date: Wed, 20 Dec 2000 12:42:10 -0800

Colons are perfectly legal. A colon within an element name (as Mike Brown
mentioned) is used to separate a namespace prefix from the local element
name. A parser that is namespace aware should handle this just fine. A
parser that is not namespace aware should just treat it as part of the
element name and pass it through to the application. If your parser is
having problems with a colon, then there is a problem with the parser.

There are standard ways of escaping special characters (outlined in the XML
1.0 spec at http://www.w3.org/TR/2000/REC-xml-20001006). The ampersand is a
special character that is used to denote the start of an escaped special
character. A literal ampersand within attribute or element content must
itself be escaped as "&amp;". If an ampersand appears within the content,
and that ampersand is not the start of a valid token representing an escaped
special character, then the XML is invalid and a properly implemented parser
(if it recognizes this case) will raise an error. For example, if the
document contains something like "<ice-cream-brand>Ben &
Jerry's</ice-cream-brand>", that would be invalid XML. But
"<ice-cream-brand>Ben &amp; Jerry's</ice-cream-brand>" would be legal, and
an XML parser would return the string "Ben & Jerry's" to the application as
the element content.

> -----Original Message-----
> From: James Gray [mailto:james.gray@buildpoint.com]
> Sent: Wednesday, December 20, 2000 10:35 AM
> To: xml-dev@lists.xml.org
> Subject: RE: escaping characters
> 
> 
> 
> The parser is giving me a generic error -- nothing specific
> enough to debug.  If the ':' is special, how would I escape
> it?  Different parsers escape certain characters differently,
> correct?
 




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS