[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: escaping characters
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 "&". 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 & 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@b...] > Sent: Wednesday, December 20, 2000 10:35 AM > To: xml-dev@l... > 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?
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|