How to get XML structure with jquery? -


Is it possible to map the structure of an XML file with jquery? After calling AJAX, the client gets an XML file, but it does not know the file's node structure, how can we get all its contents? Thanks

EDIT: Changing the node structure for the exam for this XML I can rebuild the exact node structure with jquery?

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Children & gt; & Lt; Children & gt; & Lt; Name & gt; Daniel & lt; / Name & gt; & Lt; Age & gt; 5 & ​​lt; / Age & gt; & Lt; Eye & gt; Brown & lt; / Eye & gt; & Lt; / Children & gt; & Lt; Children & gt; & Lt; Name & gt; Herold & lt; / Name & gt; & Lt; Mother & gt; Helena & lt; / Maan & gt; & Lt; Hobbies & gt; Painting & lt; Hobbies & gt; & Lt; / Children & gt; & Lt; Children & gt; & Lt; Name & gt; Catlin & lt; / Name & gt; & Lt; Birthday & gt; 2006/05/26 & lt; / Birthdays & gt; & Lt; / Children & gt; & Lt; / Children & gt;  

If this is your XML ('Data.xml'):

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Url & gt; & Lt; URL & gt; & Lt; Name & gt; Google & lt; / Name & gt; & Lt; Link & gt; Www.google.com & lt; / Link & gt; & Lt; / URL & gt; & Lt; URL & gt; & Lt; Name & gt; Blown & lt; / Name & gt; & Lt; Link & gt; Http: //www.blah.com< / Link & gt; & Lt; / URL & gt; & Lt; / Urls & gt;  

You can parse it like this:

  $ (document) .ready (function () {$ .get ('Data.xml' (Function) (xml) .find ('url'). (Function () {warning ($ (this) .find ('link'). Text ()); alerts ($ (this) 'Name'). Text ());})}};});  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -