我試圖輸出,而不XML頭一個XML文件,像 我想:如何在序列化時跳過xml聲明?
Type t = obj.GetType();
XmlSerializer xs=new XmlSerializer(t);
XmlWriter xw = XmlWriter.Create(@"company.xml",
new XmlWriterSettings() { OmitXmlDeclaration = true, Indent = true });
xs.Serialize(xw,obj);
xw.Close();
,但它仍然在xml文件outputing。 我不想要字符串技巧。有任何想法嗎?
爲什麼你想要做這樣的事情,我只是好奇:)? – 2012-02-17 17:16:11
因此發現了類似的東西,看看:http://stackoverflow.com/questions/933664/net-xml-serialization-without-xml-root-node。 – 2012-02-17 17:18:35
也許輸出一些片段,這些片段後來被添加到文檔中?或者可能通過像XMPP這樣的套接字發送XML片段呢?大量的使用爲:) – dowhilefor 2012-02-17 17:18:47