1
我目前使用DOM在C#项目中导航xml。但是,我最近遇到的一些XML有些不同。用C#/ DOM读取不同的XML
,而我通常有:
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<entry>
<author>
<name>Me =)</name>
</author>
<content>
<somefield1>
<Subfield>subfield data</subfield>
</somefield>
</content>
</entry>
</feed>
,可以导航使用的foreach条目条目的SelectSingleNode(/内容/ somefield1 /子),innerText属性来从子为每个条目的数据,新的XML看起来是这样的:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<atom:feed xmlns:atom="http://www.w3.org/2005/Atom">
<atom:entry>
<atom:author>
<name>Me =)</name>
</atom:author>
<atom:content>
<somefield1>
<Subfield>subfield data</subfield>
</somefield>
</atom:content>
</atom:entry>
</atom:feed>
的SelectSingleNode(/原子:内容/ somefield1 /子)肯定是行不通的......有什么建议?
卫生署!我没有意识到这是一个标准的命名空间!非常感谢! – 2010-11-18 02:46:10