0
我有這個非常簡單的代碼和一個簡單的XML文件的和平。我正在讀取每個節點並將其寫入另一個文件,並確實讓xml讀取器跳過每個備用記錄節點。它從下面的文件中寫入1和3個節點!任何幫助讚賞。XMLReader跳過每個備用節點
Do While (reader.Read())
If (reader.NodeType = XmlNodeType.Element And (reader.LocalName = "record" Or reader.LocalName = "record1")) Then
writer.WriteNode(reader, True)
writer.Flush()
End If
Loop
-
<?xml version="1.0" encoding="UTF-8"?>
<records xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="world-check.xsd">
<record>
<foo>
<bar>wtf3</bar>
<bar>wtf4</bar>
</foo>
</record>
<record>
<foo>
<bar>wtf4</bar>
<bar>wtf5</bar>
</foo>
</record>
</records>
你能肯定嗎?該代碼產生該樣本中的所有記錄... – 2012-07-20 00:38:47