0

I have a question regarding dom selectors. This is a part of an xml file I am trying to parse.

<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 ?

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

This doesn't work.

4

1 回答 1

2

The element hasn't got any child nodes, it only has attributes.

element.getAttribute('name_of_attribute');
于 2013-02-05T13:39:45.693 回答