<?xml version="1.0" encoding="utf-8"?>
<Row>
<Cell ss:StyleID="s22" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns="urn:schemas-microsoft-com:office:spreadsheet">
<Data ss:Type="String">
<xsl:value-of select="ds:TxnId" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
</Data>
<Comment ss:Author="alen">
<ss:Data xmlns="http://www.w3.org/TR/REC-html40">
<B>
<Font html:Face="宋体" x:CharSet="136" html:Size="9" html:Color="#000000" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html="http://www.w3.org/TR/REC-html40"><xsl:value-of select="ds:TxnId" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></Font>
</B>
</ss:Data>
</Comment>
</Cell>
<Cell xmlns="urn:schemas-microsoft-com:office:spreadsheet">
<Data ss:Type="String" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<xsl:value-of select="ds:JobType" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
</Data>
<Comment ss:Author="alen" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<ss:Data xmlns="http://www.w3.org/TR/REC-html40">
<B>
<Font html:Face="宋体" x:CharSet="136" html:Size="9" html:Color="#000000" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html="http://www.w3.org/TR/REC-html40"><xsl:value-of select="ds:JobType" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></Font>
</B>
</ss:Data>
</Comment>
</Cell>
<Cell xmlns="urn:schemas-microsoft-com:office:spreadsheet">
<Data ss:Type="String" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<xsl:value-of select="ds:Seq" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
</Data>
<Comment ss:Author="alen" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<ss:Data xmlns="http://www.w3.org/TR/REC-html40">
<B>
<Font html:Face="宋体" x:CharSet="136" html:Size="9" html:Color="#000000" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html="http://www.w3.org/TR/REC-html40"><xsl:value-of select="ds:Seq" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></Font>
</B>
</ss:Data>
</Comment>
</Cell>
</Row>
請問。。我怎麼樣才能把Row 下面的 <Comment></Comment>的這個節點刪除掉.
<Row>
<Cell ss:StyleID="s22" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns="urn:schemas-microsoft-com:office:spreadsheet">
<Data ss:Type="String">
<xsl:value-of select="ds:TxnId" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
</Data>
<Comment ss:Author="alen">
<ss:Data xmlns="http://www.w3.org/TR/REC-html40">
<B>
<Font html:Face="宋体" x:CharSet="136" html:Size="9" html:Color="#000000" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html="http://www.w3.org/TR/REC-html40"><xsl:value-of select="ds:TxnId" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></Font>
</B>
</ss:Data>
</Comment>
</Cell>
<Cell xmlns="urn:schemas-microsoft-com:office:spreadsheet">
<Data ss:Type="String" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<xsl:value-of select="ds:JobType" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
</Data>
<Comment ss:Author="alen" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<ss:Data xmlns="http://www.w3.org/TR/REC-html40">
<B>
<Font html:Face="宋体" x:CharSet="136" html:Size="9" html:Color="#000000" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html="http://www.w3.org/TR/REC-html40"><xsl:value-of select="ds:JobType" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></Font>
</B>
</ss:Data>
</Comment>
</Cell>
<Cell xmlns="urn:schemas-microsoft-com:office:spreadsheet">
<Data ss:Type="String" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<xsl:value-of select="ds:Seq" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" />
</Data>
<Comment ss:Author="alen" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<ss:Data xmlns="http://www.w3.org/TR/REC-html40">
<B>
<Font html:Face="宋体" x:CharSet="136" html:Size="9" html:Color="#000000" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:html="http://www.w3.org/TR/REC-html40"><xsl:value-of select="ds:Seq" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"/></Font>
</B>
</ss:Data>
</Comment>
</Cell>
</Row>
請問。。我怎麼樣才能把Row 下面的 <Comment></Comment>的這個節點刪除掉.
xmlDoc.Load("路径");
XmlNodeList xnl = xmlDoc.DocumentElement.SelectNodes("./Comment");
foreach (XmlNode xn in xnl)
{xn.RemoveAll() //删除该节点}
xmlDoc.Save("路径");
doc.Load("");
XmlNode no= doc.SelectSingleNode("");
if(no!=null)
{
XmlElement xe=(XmlElement)no;
xe.RemoveAll();
}
http://topic.csdn.net/u/20100430/15/562a0756-50cd-4761-bdf9-caaad0e499e4.html
這樣取不到Comment這個節點
XmlNodeList xnl = xmldoc.GetElementsByTagName("Comment");
foreach (XmlNode xn in xnl)
{
XmlElement xe = (XmlElement)xn;
xe.RemoveAll();//删除该节点的全部内容
}我是這樣刪除。。只刪除了裏面的內容。沒有把這個節點完全給刪除
最後還有 <Comment></Comment> 這個節點。。我現在要把這個<Comment></Comment> 節點。。全都刪除。
上面所有的方法<Comment></Comment> 這個節點都刪不掉。
在線等....