473,491 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

fixing up a string to make it a valid XML attribute name ...

Hi

Goal: trying to validate a string to see if it can be a valid XML
attribute name and, if not, replace any of the invalid characters with
an underscore (to fix it up).

Is there anything in the dot net framework to help with this? If not,
I'm guessing writing a regular expression is the way forward.

The specification is 2.3 Common Syntactic Constructs at
http://www.w3.org/TR/xml/ .

If I do write a regular expression will I really have to write one to
cover all those entries in e.g. CombiningChar!?!?!

Thinking my approach is wrong and time-consuming. Am I on the right
track or can someone advise me of a better way?

Thanks!

Emma

Sep 4 '06 #1
1 1933
Hello,

This may help you:

writer.WriteElementString(XmlConvert.EncodeName("O rder Detail"), "My
order")
http://msdn2.microsoft.com/en-us/library/xfaz0c52.aspx

Michael
http://www.seeknsnatch.com
<em**************@fastmail.fmwrote in message
news:11**********************@74g2000cwt.googlegro ups.com...
Hi

Goal: trying to validate a string to see if it can be a valid XML
attribute name and, if not, replace any of the invalid characters with
an underscore (to fix it up).

Is there anything in the dot net framework to help with this? If not,
I'm guessing writing a regular expression is the way forward.

The specification is 2.3 Common Syntactic Constructs at
http://www.w3.org/TR/xml/ .

If I do write a regular expression will I really have to write one to
cover all those entries in e.g. CombiningChar!?!?!

Thinking my approach is wrong and time-consuming. Am I on the right
track or can someone advise me of a better way?

Thanks!

Emma

Sep 5 '06 #2

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

Similar topics

12
4028
by: Kamilche | last post by:
I was looking for a way to speed up detecting invalid characters in my TCP string, and thought of yet another use for the translate function! If you were to 'translate out' the bad characters, and...
37
12689
by: ajay | last post by:
How to make a web page getting refreshed after a given time interval automatically. HTML Code plz. Tx Ajay
2
1544
by: Anthony LaMark | last post by:
Hi All, I am generating a (X)HTML page in an IE webbrowser control (housed by a .Net WinForm application) from a XML file using XSLT (using Msxml2.DOMDocument.4.0). When the user clicks a...
32
14760
by: tshad | last post by:
Can you do a search for more that one string in another string? Something like: someString.IndexOf("something1","something2","something3",0) or would you have to do something like: if...
18
7312
by: William | last post by:
I have the following javascript function that updates a scroll_list and sends the updated entry (with its index) to a server script ( i.e. http://mkmxg00/cgi/confirmUpload.pl ) for further...
10
16374
by: dba123 | last post by:
Why am I getting this error for Budget? Error: An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code Additional information: String was not...
37
8904
by: sam44 | last post by:
Hi, At startup the user log on and chooses the name of a client from a dropdownlist, which then changes dynamically the connection string (the name of the client indicates which database to use)....
5
2114
by: emma_middlebrook | last post by:
Hi I've found the rules that cover what is a valid attribute name here: http://www.w3.org/TR/2006/REC-xml-20060816/ 2.3 Common Syntactic Constructs Is there anything already in the dotnet...
17
5227
by: Petyr David | last post by:
Just looking for the simplest. right now my perl script returns an error messge to the user if the date string is invalid. would like to do this before accessing the server. TX
0
6978
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
7154
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
7360
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...
0
5451
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4881
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4578
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3086
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3076
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
280
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.