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

Home Posts Topics Members FAQ

Helper classes for dealing with XML Names

Does the .NET Framework have and helper classes that will help my code
generate and/or validate XML Names or NCNames? From the spec:

NCName::= (Letter | '_') (NCNameChar)* /* An XML Name, minus the
":" */
NCNameChar::= Letter | Digit | '.' | '-' | '_' | CombiningChar |
Extender

I want to strip out any offending characters and make sure my code only
generates valid names.

Thanks! -Steve
Nov 12 '05 #1
2 1745
Thanks!

"Oleg Tkachenko" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:uW**************@tk2msftngp13.phx.gbl...
Stephen Walch wrote:
Does the .NET Framework have and helper classes that will help my code
generate and/or validate XML Names or NCNames? From the spec:

NCName::= (Letter | '_') (NCNameChar)* /* An XML Name, minus the ":" */
NCNameChar::= Letter | Digit | '.' | '-' | '_' | CombiningChar |
Extender


For validation purposes you can use XmlConvert.VerifyName() and
XmlConvert.VerifyNCName() methods.
I want to strip out any offending characters and make sure my code only
generates valid names.


Stripping might be dangerous, consider "foobar" and "foo bar" strings -
after stripping they become the same name.
Instead take a look at XmlConvert.EncodeName()/XmlConvert.DecodeName()
methods.
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog

Nov 12 '05 #2
Stephen Walch wrote:
Does the .NET Framework have and helper classes that will help my code
generate and/or validate XML Names or NCNames? From the spec:

NCName::= (Letter | '_') (NCNameChar)* /* An XML Name, minus the
":" */
NCNameChar::= Letter | Digit | '.' | '-' | '_' | CombiningChar |
Extender
For validation purposes you can use XmlConvert.VerifyName() and
XmlConvert.VerifyNCName() methods.
I want to strip out any offending characters and make sure my code only
generates valid names.


Stripping might be dangerous, consider "foobar" and "foo bar" strings -
after stripping they become the same name.
Instead take a look at XmlConvert.EncodeName()/XmlConvert.DecodeName()
methods.
--
Oleg Tkachenko
XML Insider
http://www.tkachenko.com/blog
Nov 12 '05 #3

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

Similar topics

8
by: Corey Lubin | last post by:
someGlobal=1 class Original: def foo(self): # Make use of someGlobal from original import * someGlobal=2
12
by: williamc | last post by:
Is there anything wrong with having several classes with the same name in the same style sheet? Something like... div.pagedown { margin: 20px 0px 20px 0px; border-top: 1px solid #caa;...
4
by: Bnaya Eshet | last post by:
I do like XPath, I really do. But I'm working on the compact framework which XPath is not included. So I come to understanding that if XPath do not come to the mountain,
2
by: Rasika | last post by:
Memory usage wise is it a good idea to specify methods in utility/helper classes as instance methods rather than static methods? Rasika.
8
by: Joe Johnston | last post by:
I need a Browser Helper object written in VB.NET Please point me at a good example. Joe MCPx3 ~ Hoping this MSDN ng three day turnaround is true. Additional info: What is a BHO? In its...
86
by: jopperdepopper | last post by:
Hi, finally giving php 5 a go, and going over the new approach to classes. Can someone clarify the public, private and protected to me? I quote the php manual: "The visibility of a property or...
6
by: mailforpr | last post by:
Suppose you have a couple of helper classes that are used by 2 client classes only. How can I hide these helper classes from other programmers? Do you think this solution is a good idea?: class...
9
by: fgh.vbn.rty | last post by:
Say I have a base class B and four derived classes d1, d2, d3, d4. I have three functions fx, fy, fz such that: fx should only be called by d1, d2 fy should only be called by d2, d3 fz should...
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
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
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
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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.