在我的xml中使用命名空間(我需要使用它來進行xsd驗證)。因爲這個,我的xpath不再工作。如何在c#中設置命名空間URI?
我的代碼:
XmlDocument doc = new XmlDocument();
doc.Load(newXmlFilePath);
和XML:
<?xml version="1.0" encoding="UTF-8"?>
<video xmlns="UploadXSD">
<title>
A vid with Pete
</title>
<description>
Petes vid
</description>
<contributor>
Pete
</contributor>
<subject>
Cat 2
</subject>
</video>
但我的XPath犯規選擇的節點。我試圖設置命名空間使用:
doc.NamespaceUR = "x";
然而,它是一個只獲得訪問者。有任何想法嗎?
已經在你的其他問題的答案http://stackoverflow.com/questions/4312103/why-doesnt-this-xpath-c-work – 2010-11-30 09:51:39
我們關閉了兩者中的哪一個? – 2010-11-30 15:12:11