Hi Alexsandro,

Do you mean....
(1)"convert the generate JSON back to XML"?
OR...
(2)"define a javascript object and convert it to XML"?

If (1):
I initially built this plugin for my personal use (for my
"convenience") so I could easily process XML data. Because of that, I
didn't bother to differentiate between attributes / nodes. ie.:
<xml><person><name>Diego</name></person></xml>
...gives the same output as this...
<xml><person name="Diego"></person></xml>
...so it would be impossible to "reverse the conversion".

If (2):
This is quite easy. And actually, it would be pretty similar to the
code I wrote to show the JSON structure in HTML (Under Examples >
Basic/Extended Structure)

I will write this when I get a chance, but I'd rather wait for the
feedback on this plugin to work out the best way to do it...

Cheers,
Diego

Alexsandro_xpt wrote:
> Very good!!!
>
> Are possible to do reverse?
>
>
>
> --
> Alexsandro
> www.alexsandro.com.br
>
> On 4 jul, 12:34, Diego <[EMAIL PROTECTED]> wrote:
> > I wrote this a few months but didn't have the time to share it. Now
> > that I've re-done the documentation for 2 of my plugins I thought I'd
> > give it a few hours, knock some examples together and share it with
> > the whole world (ok, maybe just a few people).
> >
> > Basic example:
> > var xml = '<xml><message>Hello world</message></xml>';
> > var json = $.xml2json(xml);
> > alert(json.message); // shows "Hello world"
> >
> > Ajax example:
> > var file = 'data/hello.xml'; //<xml><message>Hello world</message></
> > xml>
> > $.get(file, function(xml){
> > �var json = $.xml2json(xml);
> > �alert(json.message);
> >
> > });
> >
> > See the documentation page for more examples and demos.
> > XML to JSON Plugin -http://fyneworks.com/jquery/xml-to-json/
> >
> > As always, feedback is welcome!
> >
> > Cheers,
> > Diego

Reply via email to