Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hyphen in last name

Status
Not open for further replies.

jojo11

Programmer
Joined
Feb 2, 2003
Messages
189
Location
US
I have a .net app that pulls in an XML document containing custmer information. The xsd has the last name as xs:string.
When I import into the .NET DOM object, it fails on validation when the last name contains a hyphen.
How can we get around this, with a change to the xsd?

-------------------------------------------
Ummm, we have a bit of a problem here....
 
You shouldn't have any problems with a hyphen (dash, "-") character. The ones to watch out for are the ampersand "&", single-quote "'", double-quote """, less-than "<", and greater-than ">". These all have predefined entity values in the W3C spec:
[tt][ignore]
' &apos;
" &quot;
& &amp;
> &gt;
< &lt;
[/ignore][/tt]
The supplier of your XML data would use these in place of the original characters. Your parser would then read them and replace them in memory with the originals.

The Microsoft XML 4.0 SP2 parser is pretty tolerant of not having these, but other parsers are much more strict, so you should make an effort to use them in any XML documents you produce for others.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top