I don't have any reason for choosing XML, I thought XML can be manipulated easily with JQuery and the data i am having is well structured one.
let me know if you have some other way of doing this? Karthick On Dec 2, 1:08 am, Michel Belleville <michel.bellevi...@gmail.com> wrote: > I'm not sure you can even do that with jQuery the way you'd like to do it. > > Is it so important to use xml for medium ? > > Michel Belleville > > 2009/12/1 karthick <mskarth...@gmail.com> > > > > > Hi Michel, > > > Thank you very much for pointing that, now its clear why it > > wasn't updating. But can you give me some idea on how I can achieve > > this functionality. I just want to manipulate the xml at client side > > using jquery and finally send it back to the server as string. I was > > trying with append() and replaceWith() function in vain!! :( > > I would like to do it with Jquery because i need some browser > > compatibility. Is this really possible with jquery? > > > Thanks for your time > > karthick > > > On Dec 1, 10:01 pm, Michel Belleville <michel.bellevi...@gmail.com> > > wrote: > > > Easy, you're not working on the original xml string, you're working on a > > dom > > > object generated using the string as original. It's not attached to your > > > theXml variable anymore. > > > > Michel Belleville > > > > 2009/12/1 karthick <mskarth...@gmail.com> > > > > > Hi Guys, > > > > > I have an simple xml dom (which is parsed from a string) like this > > > > > <PersonList> > > > > <Person> > > > > <PersonId>1</PersonId> > > > > <LocationId>1</LocationId> > > > > <AnswerId>1</AnswerId> > > > > </Person> > > > > </PersonList> > > > > > Now using the jquery find() method I am able to get the value of > > > > PersonId. But what I really want is to modify its value to 30 > > > > > ie after updating the xml it should look like this > > > > > <PersonList> > > > > <Person> > > > > <PersonId >30</PersonId> > > > > <LocationId>1</LocationId> > > > > <AnswerId>1</AnswerId> > > > > </Person> > > > > </PersonList> > > > > > Here is the code I am trying with > > > > > <script type="text/javascript"> > > > > var theXml = "<PersonList><Person><PersonId>1</PersonId><LocationId>1</ > > > > LocationId><AnswerId>1</AnswerId></Person></PersonList>"; > > > > > $(document).ready(function(){ > > > > > $("#butSub").click(function(event){ > > > > theXml = parseXml(theXml); > > > > $(theXml).find('Person').each(function(){ > > > > $(this).find('PersonId').text("30"); > > > > alert($(this).find('PersonId').text()); > > //This > > > > alert shows the updated value 30 for PersonId node > > > > }); > > > > alert(theXml); //This alert shows old value 1 for > > PersonId > > > > node. > > > > }); > > > > }); > > > > function parseXml(xml) > > > > { > > > > if (jQuery.browser.msie) > > > > { > > > > var xmlDoc = new > > ActiveXObject("Microsoft.XMLDOM"); > > > > xmlDoc.loadXML(xml); > > > > xml = xmlDoc; > > > > } > > > > return xml; > > > > } > > > > </script> > > > > > Could you guys tell me where I am going wrong? or Is there any other > > > > better way of doing this? > > > > > I really really appreciate your help on this > > > > > Thank you > > > > Karthick