I have an XML file with no namespaces defined:
<data>
<textItems>
<add name="test" value="test value"/>
</textItems>
</data>
I can map this to a class with:
[XmlRoot]
public class data
{
[XmlArray("textItems", Form=XmlSchemaFor.Unqualified)]
[XmlArrayItem("add", typeof(addItem), Form=XmlSchemaFor.Unqualified)]
public addItem[] Items;
}
public class addItem
{
[XmlAttribute] public string name;
[XmlAttribute] public string value;
}
That is fine. I can read in the XML file, deserialize it with XmlSerializer
to a data object and access the Items. I can alter the Items array and write
the data object to the XML file by serializing it.
However, I find that the XmlSerializer writes the root element with
xmlns:xsd and xmlns:xsi attributes:
<data xmlns:xsd="stuff" xmlns:xsi="stuff">
<!-- stuff -->
</data>
How do I prevent that? [XmlRoot] does not have a Form property.
Richard
--
my email ev******@zicf.bet is encrypted with ROT13 (www.rot13.org)