且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从XML文档获取特定数据

更新时间:2022-01-16 04:17:07

尝试:
XmlNodeList xnList = document.SelectNodes("/level1/level2/level3/*[self::attribute1 or self::attribute2 or self::attribute3]");


这应该为您提供所有属性节点的列表.


This should give you a list of all attribute nodes.


不,您没有XML这样的文档".您在问题中显示的是不是 XML代码,这是格式不正确的,因此根本无法解析.如果您想问一下解析具有类似于XML的结构的文本,请解释这种格式并询问您的问题,但不要问关于XML的问题-您的问题中没有这种事情.

—SA
No, you don''t have XML "document like this". What you show in your question is not an XML code, this is something not well-formed so it won''t parse at all. If you want to ask about parsing some text which has a structure resembling XML, explain this format and ask your question about it, but don''t ask a question about XML — there is no such thing in your question.

—SA