开发者

How Can I stop insertion of assembly information whlie using WriteXml

I am using IXmlSerializable interface for conversion of Dataset table objects in to XML format.

Please find the class example below.

public class SecondaryRNCTable: IXmlSerializable
{
    public void ReadXml(System.Xml.XmlReader reader)
    {
        IP = reader.GetAttribute("IP");
        int count = int.Parse(reader.GetAttribute("count"));
        reader.ReadStartElement();

        for (int i = 0; i < count; ++i)
        {
            reader.ReadStartElement();
            SecondaryRNC rnc = new SecondaryRNC();
            rnc.ReadXml(reader);
            Add(rnc);
        }
    }

    public void WriteXml(System.Xml.XmlWriter writer)
    {
        writer.WriteAttributeString("IP", parentDOMIP);
        writer.WriteAttributeString("count", Count.ToString());
        writer.WriteStartElement("SecondaryRNCs");

        foreach (SecondaryRNC rnc in this)
        {
            writer.WriteStartElement("SecondaryRNC");
            rnc.WriteXml(writer);
            writer.WriteEndElement();
        }
        writer.WriteEndElement();
     }
}

we add multiple datatables in a dataset say ds and ds.writeXML(GZipOutputStream, XmlWriteMode.WriteSchema) is invoked to write in outputstream. So for some tables, it also write assembly information shown below.

msdata:InstanceType="NeighborList.SecondaryRNCTable, projectName, Version=14.0.0.12, Culture=neutral, PublicKeyToken=c2e771ef06d8dbb7"

How can I stop this inse开发者_如何学Crtion of string while writing in to outputstream?

Please provide input ASAP.

Thanks


One option would be to pass it into an XSLT transformer, which will allow you to format the XML however you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜