2013-05-08 96 views
1

我有一塊XML的其中含有一種自行閉合標籤就像如下:.NET XML節點自動關閉標籤

<GivenNode /> 
    <GivenNode>This has some data in it</GivenNode> 

如何測試是否「GivenNode」是空的?

If Not objChildNOde.SelectSingleNode("GivenNOde").Value Is Nothing Then 
         'Do Something or other 
    End If 

這會返回錯誤的方式,我知道它一定很容易,但我不能弄明白。我寧願不必改變我在XMLFile時使用的代碼,但如果必須的話,我可以。

感謝您的幫助。

+0

您可以驗證它是否有孩子。 – Marco 2013-05-08 15:16:57

回答

1

如果其他人有同樣的問題,因爲我,我周圍有使用下面的代碼

 If Not objChildNOde.SelectSingleNode("GivenNode").InnerText = String.Empty Then 
         //Do Something or other 
     End If