I am trying to serialize some objects derived from a third-party .NET Lib into an XML file.
When I Go To Definition for an object, some of the properties of this object are marked as [XMLIgnore]
Is there a way to tell my System.Xml.Serialization.XmlSerializer ignore the fact that some properties have this attribute and that it should serialize everything in the object.
I could probably get the source code and recompile it without XMLIgnore attributes, but it would be nice if the XmlSerializer had some nice override property like
XmlSerializer xmls = new XmlSerializer( typeof(MyObject), Settings.DoNotApplyXMLAttributeRules );
Thanks in advance
EDIT
They tried XmlAttributeOverrides, as suggested, but did not experience much joy. Here is the definition of the object (it is from the FlickrAPI for the photo)
[Serializable] public class Photo {
And heres the serializer code that I wrote ... still doesn't work ...
XmlWriter xtw = XmlWriter.Create( Server.MapPath("~/App_Data/Data.xml") ); XmlAttributes photoAttributes = new XmlAttributes(); photoAttributes.XmlIgnore = false; XmlAttributeOverrides photoOverrides = new XmlAttributeOverrides(); photoOverrides.Add(typeof(Photo), "LargeUrl", photoAttributes); XmlSerializer xmlphoto = new XmlSerializer(typeof(Photo), photoOverrides);
Eoin campbell
source share