On Wed, Jul 9, 2008 at 12:38 PM, Wallonman <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Some hours that I don't understand why this basic Xml parsing with
> JQuery doesn't work:
>
>$(document).ready(function() {
>
>var xml = '>Hello World!';
>
>alert($("p", xm
It seems that the DOM parsed 'on the fly' isn't ready for querying.
When doing something weird like:
var xml = $('Hello World!Bye World!');
$(xml).appendTo("body");
then the
alert($("p").text()); // without context
works !
Hi there,
This plugin might be useful:
XML to JSON plugin v1.0
http://www.fyneworks.com/jquery/xml-to-json/
Cheers,
Diego A.
2008/7/9 Wallonman <[EMAIL PROTECTED]>:
>
> It seems that the DOM parsed 'on the fly' isn't ready for querying.
>
> When doing something weird like:
>
> var xml = $('Hel
Not sure if this is the best reply, but in order to access the
structure, it has to be part of the DOM, so best to inject in into a
placeholder first:
$('#placeholder).html(xml) // probably need to kill the xml
declaration first
Then you can use jQuery to traverse the tree.
:D
Actually if it doesn't have to be part of the DOM assuming you are
passing in a context as the second parameter of $() which the original
author is.
I don't use the xpath plugin so I'm not sure about that but the second
attempt you said failed worked for me. I got 3 alert boxes with '1',
'2', '3
the first try will not work with latest jquery, as xpath is now into a
seperate plugin. So stick to your second try. Also, make sure you search
your xml when the xml is actually loaded, so in the ajax function callback
$.ajax({//your params here}, function(xml,status){
if(status=='success'){
$('bu
On Mon, 2008-01-28 at 17:39 -0800, Dave Stewart wrote:
> Not sure if this is the best reply, but in order to access the
> structure, it has to be part of the DOM,
That is not correct. You can build a jQuery instance from a xml object
and use the various jQuery query options to search through the
Thanks David and Tim,
I didn't know that. Very useful.
8 matches
Mail list logo