Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

schemaLocation problem with Serialization.

$
0
0
I am using serialization in c# 3.0 (trying to serialize).  I want to use the schemaLocation xml attribute as that is what is in an example i need to stick to. I cannot work out what c# attribute i need to use to do this.

I have tried:

Code Snippet

public Class exampleClass
{
        [System.Xml.Serialization.XmlAttributeAttribute("schemaLocation", Namespace = "http://www.rewerse.net/I1/2006/R2ML http://oxygen.informatik.tu-cottbus.de/R2ML/0.4/R2ML.xsd")]
        public string schemaLocation;
}



where "exampleClass" is the root node in the serialized document.

The output should be like:

Code Snippet

<exampleClass schemaLocation="http://oxygen.informatik.tu-cottbus.de/R2ML/0.4/R2ML.xsd">
     ...
</exampleClass>


what comes out is more like:

Code Snippet

<exampleClass xmlns="http://oxygen.informatik.tu-cottbus.de/R2ML/0.4/R2ML.xsd">
     ...
</exampleClass>






Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>