473,396 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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
Jul 20 '05 #1
1 18822
hi,

"Jadow" <cy*********@yifan.net> wrote in message
news:bd**************************@posting.google.c 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
Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Leif B. Kristensen | last post by:
I'm working with a Python program to insert / update textual data into a PostgreSQL database. The text has single and double quotes in it, and I wonder: What is the easiest way to escape quotes in...
18
by: Steve Litvack | last post by:
Hello, I have built an XMLDocument object instance and I get the following string when I examine the InnerXml property: <?xml version=\"1.0\"?><ROOT><UserData UserID=\"2282\"><Tag1...
4
by: Guadala Harry | last post by:
I need to place the following into a string... How can I properly escape the % " / < and > characters? <table width="100%" border="0" cellspacing="0" cellpadding="4px" class="hfAll"></Table> ...
16
by: sudhir | last post by:
hi how to check escape key is pressed when accepting the string as input. Because I do not want to receive a string if user presses the ESCAPE key.. I used ascii code for comparision but I...
5
by: nummertolv | last post by:
Hi, My application is receiving strings, representing windows paths, from an external source. When using these paths, by for instance printing them using str() (print path), the backslashes are...
0
by: Asif Mohammed | last post by:
Hello, I have a datagridview bound to a database table with 2 columns. One is an ID column "NameID" which is hidden, the other is called "Name". The schema picture is here :...
0
by: Asif Mohammed | last post by:
Hello, I have a datagridview bound to a database table with 2 columns. One is an ID column "NameID" which is hidden, the other is called "Name". The schema picture is here :...
161
by: Dan Lenski | last post by:
Hi all, I'm a recent, belated convert from Perl. I work in a physics lab and have been using Python to automate a lot of measurement equipment lately. It works fabulously for this purpose. ...
6
by: sloan | last post by:
I have a fairly simple RegEx code below. I am given a file name, (which I don't control) , and need to change a folder name in it. The code below is choking on the filename not being...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.