如何使用WriteXml停止插入装配信息 [英] How Can I stop insertion of assembly information whlie using WriteXml
问题描述
我正在使用IXmlSerializable接口将数据集表对象转换为XML格式.
请在下面找到课程示例.
Hi,
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();
}
}
我们在数据集中添加多个数据表,例如ds和
调用ds.writeXML(GZipOutputStream,XmlWriteMode.WriteSchema)以写入outputstream.
因此,对于某些表,它还会编写如下所示的程序集信息.
msdata:InstanceType ="NeighborList.SecondaryRNCTable,projectName,Version = 14.0.0.12,Culture = neutral,publicKeyToken = c2e771ef06d8dbb7"
在写入outputstream时如何停止字符串的插入?
请尽快提供输入.
谢谢,
Khyati Vaghela.
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 insertion of string while writing in to outputstream?
Please provide input ASAP.
Thanks,
Khyati Vaghela.
推荐答案
使用标准序列化过程时,据我所知,您不能这样做.它写入该字符串以标识要序列化的类型,因此它知道要反序列化的内容.
While using the standard serialisation process, you can''t (as far as I know). It writes that string to identify the type that is being serialised, so it knows what to call to deserialise.
这篇关于如何使用WriteXml停止插入装配信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!