got it!
$("Test", data).each(function(i){
console.log($(this).attr("name"));
console.log($("json", this).text());
});
On Mon, Dec 29, 2008 at 11:16 AM, Anonymous wrote:
> ok, I find that I can get the json element very easy but still haven't
> found a way to get the attribute name.
> $("Test", data).each(function(i){
> console.log($("[...@name]", this).text()); // does not work.
> console.log($("json", this).text()); // does work
> });
> I have tried with the following queries: /te...@name]
>/t...@name
>t...@name
>@name
>
> Is this jQuery not supporting attribute selectors or is my xpath wrong?
>
> thanks in advance, jon.
>
>
> On Tue, Dec 23, 2008 at 4:40 PM, Anonymous wrote:
>
>> Hi all.
>>
>> I'm trying to get some values from an XML document in jQuery but lack of a
>> (good) debugger in IE6 means that I can't figure this out.
>> The XML is simple:
>> XML:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> I get it through jQuery.get and the document is in the variable data:
>> $("Test", data).each(function(i){
>> alert(this.childNodes[0].textContent);
>> /*toc.append(
>> tc.li(
>> testLink(this.childNodes[1].textContent,
>> this.attributes[0].nodeValue)
>> )
>> );*/
>> });
>>
>> The commented bit works in FF3 and I have found that it's the childNodes
>> of the Test element that differs. Is there a safer way to query an XML
>> document with jQuery, so I don't run into these abnormalties between
>> browsers?
>>
>> Thanks in advance, Jon.
>>
>
>