Sign In/My Account | View Cart  
advertisement

Article:
 jQuery and XML
Subject: Namespace, prefix and jquery
Date: 2008-09-11 12:10:40
From: SylvainH

If you have a document where elements are prefixed the way to perform a query is as follow (imaging the following Atom document snippet):


<atom:entry xmlns:atom="http://www.w3.org/2005/Atom">
...
<atom:content type="text">blah blah</atom:content>
</atom:entry>


Now if that document is stored in a variable named xml:


$(xml).find('atom\\:content').eq(0).text()


Will return the text of the atom:content element.


Previous Message Previous Message   Next Message Next Message


Sponsored By: