Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > escape colon in xml tag names

Reply
Thread Tools

escape colon in xml tag names

 
 
Jadow
Guest
Posts: n/a
 
      01-14-2004
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
 
Reply With Quote
 
 
 
 
Toni Uusitalo
Guest
Posts: n/a
 
      01-14-2004
hi,

"Jadow" <> wrote in message
news: om...
> 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?


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


 
Reply With Quote
 
 
 
Reply

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to read strings cantaining escape character from a file and useit as escape sequences? slomo Python 5 12-02-2007 11:39 AM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
WSDL- Mapping Application Defined Names to XML Names Craig XML 0 02-09-2004 04:14 PM
tag to escape other tags hoke HTML 3 01-30-2004 12:03 AM
XSL rules applying to XSD (XML schema) defined type names (as opposed to node names) Lewis G. Pringle, Jr. XML 0 09-30-2003 10:34 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57