toXMLString among other utilities from Reusable.XML

B

Bhasker V Kode

A few days ago I found myselfa in a situation where I had an xml
object ,but needed to divert certain child nodes to different
functions / calls . Let me explain with an illustration :


<------------------ huge xml string -----------------------------------<-- this partgoes to js ---><!-- this part goes to flash ---->

This is how the code looks like in pseudo alg:

- take bug string , create an xml obj
- parse through each xml obj ,
- if of type A then send chunkA to js function as xml string again
- if type B then send chunkB to flash function as xml string


Now that you have a better idea, it was apparent that I needed to call
an xml object to string function . But i was surprised not to find a
function that served the purpose and also importantly that was cross
browser as well . So i wrote one ! 8 )

Lot of other languages have the toXmlString implemented. infact the
folks at mozilla have it . but from what i've seen its meant to
convert objects of a native xml datatype (new native datatype in
javacript 1.7) .

Here's how you use it :
var xmlObj = new Reusable.XML.getXMLTree(t1.value);
alert ( Reusable.XML.toXMLString(tempXml) );

See the demo at http://bhaskervk.com/libraries/reusable/demos/xml.php

While i was at it , i also aggregated the other related functions that
I had been building over the months. And thats the story of the launch
of the Reusable Javascript Library folks 8 ) . Check out for more
regular additions to the library at http://bhaskervk.com/libraries/reusable/

~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keep Clicking,
Bhasker V Kode
http://returnable.org/developers/kode
~~~~~~~~~~~~~~~~~~~~~~~~~~~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top