简体   繁体   English

解析xml文档

[英]Parsing xml document

I have a question regarding dom selectors. 我有一个关于dom选择器的问题。 This is a part of an xml file I am trying to parse. 这是我试图解析的xml文件的一部分。

<title>LASTorder "Reindeer"</title>
<enclosure length="23152990" type="application/x-shockwave-flash" url="http://vimeo.com/moogaloop.swf?clip_id=58822081"/>

When I do a query 当我进行查询时

getElementsByTagName('title').childnnodes[0].nodevalue 

it returns me the content of the title tag. 它返回标题标签的内容。

What query should I make to get the url value inside enclosure ? 我应该使用什么查询来获取机箱内的url值?

getElementsByTagName('enclosure').childnnodes[2].nodevalue 

This doesn't work. 这不起作用。

该元素没有任何子节点,它只有属性。

element.getAttribute('name_of_attribute');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM