Re: Maddening working with .NET/.XSDs

Tech-Archive recommends: Fix windows errors by optimizing your registry



cada0310 wrote:

So I create the above in a file, create a matching XSD in Visual Studio, and use a FileStream and XmlSerializer to try and read the thing in. I always get an error at (2,2) unless I make the 2nd line look like this:

<Chris xmlns="http://tempuri.org/Chris.xsd";>

I'm presuming that it doesn't want to parse it because it's trying to match this line in my auto-generated .CS file:

[System.Xml.Serialization.XmlRootAttribute(Namespace="http://tempuri.org/Chris.xsd";, IsNullable=false)]

Do I have to have this xmlns deal in that line or what?

You can simply use
[System.Xml.Serialization.XmlRootAttribute]
or
[System.Xml.Serialization.XmlRootAttribute(IsNullable=false)]


--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
.



Relevant Pages