Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 20th, 2005, 07:44 AM
Jadow
Guest
 
Posts: n/a
Default escape colon in xml tag names

Hi

I have an application that needs to handle non-xml characters in the
tag names such as a colon. I have not found how to escape this. I do
not want to reject the document but rather translate any characters
before building the xml. Uisng ISO codes does not work (& is not
acceptable in way in a tag name it seems). Ideally I would like to use
something like /: to escape whatever characters I need. Is there some
xml schema solutions I could use?

Thanks
Joshua
  #2  
Old July 20th, 2005, 07:44 AM
Toni Uusitalo
Guest
 
Posts: n/a
Default Re: escape colon in xml tag names

hi,

"Jadow" <cyberwombat@yifan.net> wrote in message
news:bd0178ab.0401140708.7de3f64d@posting.google.c om...[color=blue]
> Hi
>
> I have an application that needs to handle non-xml characters in the
> tag names such as a colon. I have not found how to escape this. I do
> not want to reject the document but rather translate any characters
> before building the xml. Uisng ISO codes does not work (& is not
> acceptable in way in a tag name it seems). Ideally I would like to use
> something like /: to escape whatever characters I need. Is there some
> xml schema solutions I could use?[/color]

XML spec restricts name characters roughly to:

name start: letter | '_'
other: Letter | Digit | '.' | '-' | '_'

| means OR
Letter means unicode character

Colon ':' is reserved for namespace use (might be legal in name if
namespace awareness is turned off in xml parser)

So this leaves you two options:

- Use parser that isn't conformant to xml spec (or can be configured
to ignore name checking). I personally don't recommend this option -
non-conformant parsers can give you trouble - or if you must do this,
pick a parser that has common interface/that can be replaced with
conformant parser later.

- Fix your documents. Those characters are illegal in tag names. Use
regexps etc. if you must do lot of fixing.

p.s. schemas can't help you, they deal with validity of documents,
you're dealing with well-formedness issue with illegal tag names here.

with respect,
Toni Uusitalo


 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles