0
xmlからいくつかのデータを読み込もうとしています。以下は私のXML構造体です。get xpathの問題
<Configuration>
<node1></node1>
<unity
xmlns=xmlns="http://schemas.microsoft.com/practices/2010/unity">
<namesapce name="somename"/> . . .
</unity>
</Configuration>
私は
のxpath以下var nodelist=doc.SelectNodes("/configuration/unity[@xmlns='http://schemas.microsoft.com/practices/2010/unity']");
を使用してノードを読み取るために、 "団結" を試してみました。しかし、それはnullを返します。私のコードで何が間違っていますか?
をさて、あなたは= 'のxmlns =ののxmlnsを持っている "... "'ただ一つ 'のxmlns =" ..." があるはずです'。それが疑問であると仮定すると、 'xmlns =" http://schemas.microsoft.com/practices/2010/unity "は[XML名前空間宣言](https://en.wikipedia.org/wiki/)です。 XML_namespace#Namespace_declaration)ので、[デフォルトネームスペースを使用するノードの選択方法](https://stackoverflow.com/q/14370989)と[C#でのデフォルトネームスペースでのXpathの使用](https ://stackoverflow.com/q/585812)。 – dbc