I’m working on a XUL extension and I have a XUL tree displaying data from an XML file via XUL templates (querytype="xml").
In the xul tree we have an attribute editable=”true” to edit the tree cell values. So, how can we we modify the tree cell values and save it into the same (data-sources)xml file.
For exmaple: In my xml file, FodenBen’. if we modify this FirstName value, the changed/modified value should update in my xml file.
I would like to how can i merge two different child nodes in my xml file. Like in mobile if we have a similar names in contact list it will show us a “merge” option to save it in the contact list.
If you check this link, i have loaded the xml file in xul tree but i didn’t any function to edit the tree cell values because I have no idea to start.
Please check this link to find how did i load the xml file in xul tree.
https://stackoverflow.com/questions/6482480/how-to-do-write-a-filter-query-by-assigning-query-dynamically-using-querytype-xml Here i have function which allows me to do search from xul tree but I think there is a mistake in my xquery. When i type something in the search the xul tree becomes blank otherwise it display the values from the xml file.
I have checked this Firefox developer website, they don’t have much information about editing xml file in xul. https://developer.mozilla.org/en/Parsing_and_serializing_XML
I know i’m not good at writing and explaining. I don’t want to confuse anyone and waste their time because i have learnt from my previous posts. I apologize for that and seriously i don’t want to do that mistake once again. I hope this time question is short and simple at least it’s not confusing.
Thank you very much for all your support guys.
My XML file:
<?xml version="1.0" encoding="UTF-8"?>
<CONTACTS>
<CONTACT>
<PDE-Identity>N65539</PDE-Identity>
<FirstName>Arun_niit</FirstName>
<LastName>Arun_niit</LastName>
<Facebook-ID/>
<EMAILS>
<EMail>
<Type>yahoo</Type>
<Value>nura_ice@yahoo.co.in</Value>
</EMail>
</EMAILS>
</CONTACT>
<CONTACT>
<PDE-Identity>N65546</PDE-Identity>
<FirstName>FodenBen'</FirstName>
<LastName>Ben' Foden</LastName>
<URL>http://www.facebook.com/profile.php?id=100002440474277</URL>
<Facebook-ID>100002440474277</Facebook-ID>
<EMAILS/>
</CONTACT>
<CONTACT>
<PDE-Identity>N65553</PDE-Identity>
<FirstName>GhorbelMahmoud</FirstName>
<LastName>Mahmoud Ghorbel</LastName>
<Facebook-ID/>
<EMAILS>
<EMail>
<Type>alcatel-lucent</Type>
<Value>mahmoud.ghorbel@alcatel-lucent.com</Value>
</EMail>
</EMAILS>
</CONTACT>
<CONTACT>
<PDE-Identity>N65560</PDE-Identity>
<FirstName>keyankarthik</FirstName>
<LastName>karthik keyan</LastName>
<Facebook-ID/>
<EMAILS>
<EMail>
<Type>yahoo</Type>
<Value>karthycse@yahoo.co.in</Value>
</EMail>
</EMAILS>
</CONTACT>
<CONTACT>
<PDE-Identity>N65567</PDE-Identity>
<FirstName>Rangarajkarthik</FirstName>
<LastName>karthik Rangaraj</LastName>
<Facebook-ID/>
<EMAILS>
<EMail>
<Type>gmail</Type>
<Value>kart2006@gmail.com</Value>
</EMail>
<EMail>
<Type>yahoo</Type>
<Value>karthikrangaraj@yahoo.com</Value>
</EMail>
</EMAILS>
</CONTACT>
<CONTACT>
<PDE-Identity>N65576</PDE-Identity>
<FirstName>ReddyAkky</FirstName>
<LastName>Akky Reddy</LastName>
<Facebook-ID/>
<EMAILS>
<EMail>
<Type>gmail</Type>
<Value>akkireddych@gmail.com</Value>
</EMail>
</EMAILS>
</CONTACT>
<CONTACT>
<PDE-Identity>N65583</PDE-Identity>
<FirstName>SandfordFrankie</FirstName>
<LastName>Frankie Sandford</LastName>
<URL>http://www.facebook.com/FrankieSandfordApprovedPage</URL>
<Facebook-ID/>
<EMAILS/>
</CONTACT>
<CONTACT>
<PDE-Identity>N65590</PDE-Identity>
<FirstName>TheSatsRochelle</FirstName>
<LastName>Rochelle TheSats</LastName>
<URL>http://www.facebook.com/profile.php?id=100002487211054</URL>
<Facebook-ID>100002487211054</Facebook-ID>
<EMAILS/>
</CONTACT>
<CONTACT>
<PDE-Identity>N65597</PDE-Identity>
<FirstName>KumarVeera</FirstName>
<LastName>Veera_Kumar</LastName>
<Facebook-ID/>
<EMAILS>
<EMail>
<Type>yahoo</Type>
<Value>KUMARg_81@yahoo.com</Value>
</EMail>
</EMAILS>
</CONTACT>
</CONTACTS>
XUL is interactive, and serialising XML to disk can introduce noticeable delays (due to IO) in the user interface. This explains why you haven’t found any shortcuts for editing XML in XUL. You can still write your own functions to serialise the xml, using the docs you linked to, and preferably outside the UI thread.