troubleshooting Question

.net XMLWriter and attributes

Avatar of Daniel Wilson
Daniel WilsonFlag for United States of America asked on
.NET ProgrammingVisual Basic.NETXML
9 Comments1 Solution544 ViewsLast Modified:
I'm using the XmlWriter class in .Net 2.0.

I'm trying to write the following bit of XML (it's part of a larger thing, but this is where I'm having a problem).
<Worksheet ss:Name="Sheet1">

The code below yields the error:
System.ArgumentException: Invalid name character in 'ss:Name'. The ':' character, hexadecimal value 0x3A, cannot be included in a name.    

What do I need to do instead?

Thanks!
Private Sub XMLWorkSheetHeader(ByVal iResultNum As Int16, ByVal iRows As Int32, ByVal iColumns As Int16, ByRef W As XmlWriter)
            W.WriteStartElement("Worksheet")
            W.WriteAttributeString("ss:Name", "Sheet" & iResultNum)
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros