0
我有了像這樣一個結構的XML文檔:更改XML子元素到父
<?xml version="1.0" encoding="iso-8859-1" ?>
- <newdataset xml="version="1.0" encoding="iso-8859-1"">
- <officelist>
<officeid>2</officeid>
<office>Office</office>
<region>BC</region>
我想有辦公室ID = 2是其自己的元素。像這樣
<?xml version="1.0" encoding="iso-8859-1" ?>
<newdataset xml="version="1.0" encoding="iso-8859-1"">
<officelist>
<officeid id=2/>
<office>Office</office>
<region>BC</region>
</officeid>
</officelist>
</newdataset>
xmlDS += offices.GetXml();
xmlDS = xmlDS.Replace(@"xml:space=""preserve""", " ");
XmlDocument doc = new XmlDocument();
XmlNode declaration = doc.CreateNode(XmlNodeType.XmlDeclaration, null, null);
doc.LoadXml(xmlDS);
doc.Save(Response.OutputStream);
這是我到目前爲止的代碼...不知道如何設置一個子節點成爲父節點
我不明白你在做什麼,真的....你能告訴我們輸出XML應該是什麼樣子嗎?或者你想做什麼?編輯: – 2010-07-08 16:04:15
現在在問題中 – Spooks 2010-07-08 16:43:42