Jump to content


  • Posts

  • Joined

  • Last visited

karthikin's Achievements


Newbie (1/7)



  1. This is my input xml file: <MyTest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.test.com/test"> <MyHubs xsi:nil="true" /><MyLanes xsi:nil="true" /> When i serilaize it i'm getting the output xml in this format: <MyTest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.test.com/test"> <MyHubs /><MyLanes/> How can i maintain the same format for the output xml file as exactly as the input file??
  2. This is my xml file: <?xml version="1.0" encoding="UTF-8"?><CONTACTS><CONTACT><FirstName>Arun</FirstName><LastName>Arun_Neelam</LastName><Email>nuraaa_iceee@yahoo.co.in</Email></CONTACT><CONTACT><FirstName>Arun</FirstName><LastName>Arun_Neelam</LastName><Email>nuraaa_iceee@gmail.com</Email></CONTACT></CONTACTS> I want to have the output in the following way: <?xml version="1.0" encoding="windows-1250"?><CONTACTS> <CONTACT> <FirstName>Arun</FirstName> <LastName>Arun_Neelam</LastName> <Email>nuraaa_iceee@gmail.com</Email> <Email>nuraaa_iceee@yahoo.co.in</Email></CONTACT></CONTACTS> How do i group them by checking two identical values of the <FirstName><LastName>, if it's true then take the email values and put it as a single contact.I'm not sure I can do it with current-group() and current-grouping-key().Thank you for your support.
  3. I have an xml file and I want to how can i remove the white-space in the xml file.For example this is my xml file: <?xml version="1.0" encoding="UTF-8"?><CONTACTS><CONTACT><FirstName>SandfordFrankie</FirstName><LastName>Frankie Sandford</LastName><gmail/><yahoo/><URL>http://www.facebook.com/FrankieSandfordApprovedPage</URL><Facebook-ID/></CONTACT><CONTACT><FirstName>Julien </FirstName><LastName>Foder</LastName><gmail/><yahoo/><URL/><Facebook-ID/></CONTACT><CONTACT><FirstName>Stéphénè</FirstName><LastName>Rio</LastName><gmail/><yahoo>rio.sté1234@yahoo.com</yahoo><URL/><Facebook-ID/></CONTACT><CONTACT><FirstName>Aana</FirstName><LastName>Joséph</LastName><gmail></gmail><yahoo>aana.josé@yahoo.com</yahoo><URL></URL><Facebook-ID></Facebook-ID></CONTACT></CONTACTS> If i delete a record and it'll be like this: <?xml version="1.0" encoding="UTF-8"?><CONTACTS><CONTACT><FirstName>Julien </FirstName><LastName>Foder</LastName><gmail/><yahoo/><alcatel-lucent/><URL/><Facebook-ID/></CONTACT><CONTACT><FirstName>Stéphénè</FirstName><LastName>Rio</LastName><gmail/><yahoo>rio.sté1234@yahoo.com</yahoo><URL/><Facebook-ID/></CONTACT><CONTACT><FirstName>Aana</FirstName><LastName>Joséph</LastName><gmail></gmail><yahoo>aana.josé@yahoo.com</yahoo><URL></URL><Facebook-ID></Facebook-ID></CONTACT></CONTACTS> When i delete a record from my xml file, how can i remove the white space from the file?Thanks guys.
  4. Sorry guys found the solution. The below code works fine. Thanks guys. function closeWindow() {window.close();if (window.opener && !window.opener.closed) {window.opener.location.reload();} }
  5. Hi Friends,I'm working on XUL, I have a window that opens another window. When the child window closes I want to refresh the contents of the parent.This is my first window(sundayevening.xul), which has a function to open the child window(iframetest.xul) function edit(){var windowObjectReference = window.openDialog("chrome://hello/content/iframetest.xul","iframetest", "Height=600, width=1024,resizable,scrollbars=yes,status=1" );}var sURL = unescape(window.location.pathname); function refresh(){ window.location.href = sURL;} This is my second xul file(iframetest.xul), here i have a button to close the this child window. When I close this child window, how can I refresh/reload the parent window(sundayevening.xul).In the second window, i use the following script: function closeWindow() {window.close();refresh();} My above code is not refreshing/reloading the parent window when i close the child window! Thanks for your support and help.
  6. Hi Guys,I use XSLT function to generate a unique id for my xml file <xsl:value-of select="generate-id(.)"/> and the output is "N65539".Then I used the same function and run the XSLT processor in Firefox XUL for the same XML file, the output of the id is "id0x03bb5600" in this format.How can i specify certain type to generate a unique id?This function generate id for <Customer-ID> </Customer-ID> in my XML file. Output 1: <Customer-ID>N65539</Customer-ID>Output 2: <Customer-ID>id0x03bb5600</Customer-ID>Thanks for your support.
  7. Hi guys, I have a xml file and I append a new contact in my XML file from XUL.When i append a new contact I want to generate a ID to my new customer contact in my xml file using XSLT.Is it possible to load my XSLT file through my xml file and save it? Please give me a suggestion guys!!! Thank you.My xml file: <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="idgenerator.xsl"?><CONTACTS><CONTACT><Customer-ID>N65539</Customer-ID><FirstName>Ben</FirstName><LastName>Foden</LastName><email></email><address></address><state>AZ</state><country>US</country></CONTACT><CONTACT><Customer-ID>N65539</Customer-ID><FirstName>Nimal</FirstName><LastName>Anup</LastName><email>nimal.anup@gmail.com</email><address></address><state>TN</state><country>IN</country></CONTACT><CONTACTS> My XSLT file: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes"/> <xsl:strip-space elements="*"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="CONTACT"> <xsl:copy> <PDE-Identity> <xsl:value-of select="generate-id(.)"/> </PDE-Identity> </xsl:copy> </xsl:template></xsl:stylesheet>
  8. I couldn't get the values of my XML file in my XUL tree. I have a problem with my query expr here: <query expr="*"> <assign anonid="fulltext" var="?FULLTEXT" expr= "concat(Customer-ID,FirstName,LastName,gmail,yahoo,URL,Facebook-ID)"/> </query>Please check my full code below. Thanks for you support in advance. <tree editable="false" id="myTodoListTree" flex="1" seltype="multiple"datasources="file://D:/xmlparserinxul/final.xml" ref="*" querytype="xml" > <treecols> <treecol id="pde" label="Customer-ID" flex="1" persist="width ordinal hidden" /> <treecol sortActive="true" sort="?name" id="name" label="FirstName" flex="1" persist="width ordinal hidden" sortDirection="ascending"/> <treecol sortActive="true" sort="?lastname" id="lastname" label="LastName" flex="1" persist="width ordinal hidden" sortDirection="ascending"/> <treecol sortActive="true" sort="?gmail" id="gmail" label="Gmail" flex="1" persist="width ordinal hidden" sortDirection="ascending"/> <treecol sortActive="true" sort="?yahoo" id="yahoo" label="Yahoo" flex="1" persist="width ordinal hidden" sortDirection="ascending"/> <treecol sortActive="true" sort="?url" id="url" label="Facebook" flex="1" persist="width ordinal hidden" sortDirection="descending"/> <treecol sortActive="true" sort="?pin" id="pin" label="Facebook-ID" flex="1" persist="width ordinal hidden" sortDirection="ascending"/> </treecols> <template> <query expr="*"> <assign anonid="fulltext" var="?FULLTEXT" expr= "concat(Customer-ID,FirstName,LastName,gmail,yahoo,URL,Facebook-ID)"/> </query> <rule> <conditions> <where id="filter" subject="?FULLTEXT" rel="contains" value="" ignorecase="true" multiple="true" /> </conditions> <action> <treechildren id="myTodoListTreeChildren"> <treeitem uri="?"> <treerow> <treecell label="?Customer-ID"/> <treecell label="?FirstName"/> <treecell label="?LastName"/> <treecell label="?gmail"/> <treecell label="?yahoo"/> <treecell label="?URL"/> <treecell label="?Facebook-ID"/> </treerow> </treeitem> </treechildren> </action> </rule> </template> </tree> My xml file: <CONTACTS><CONTACT><Customer-ID>N65553</Customer-ID><FirstName>John</FirstName><LastName>Killer</LastName><gmail>john.killer@gmail.com</gmail><yahoo/><URL/><Facebook-ID/></CONTACT><CONTACT><Customer-ID>N65560</Customer-ID><FirstName>Karthik</FirstName><LastName>Kayan</LastName><gmail/><yahoo>karthy@yahoo.co.in</yahoo><alcatel-lucent/><URL/><Facebook-ID/></CONTACT></CONTACTS> Solution : This solution just for FirstName:<query expr="CONTACT"> <assign var="?fname" expr="./FirstName/text()"/> </query><assign var="?fulltext" expr="concat(./FirstName/text());<rule> <conditions> <where id="filter" subject="?fulltext" rel="contains" value="" ignorecase="true" multiple="true" /> </conditions> </rule>
  9. Her is the link: //function from http://puna.net.nz/archives/Code/Mozilla%2...cal%20files.htm
  10. HI, I'm able to edit, add new contact in my XML file using java-script. Please have a look at this code:function saveFile(output, savefile) { //var savefile = "c:\\mozdata.txt"; try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch (e) { alert("Permission to save file was denied."); } var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath( savefile ); if ( file.exists() == false ) { alert( "File Updated Successfully "); file.create( Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 420 ); } var outputStream = Components.classes["@mozilla.org/network/file-output-stream;1"] .createInstance( Components.interfaces.nsIFileOutputStream ); /* Open flags #define PR_RDONLY 0x01 #define PR_WRONLY 0x02 #define PR_RDWR 0x04 #define PR_CREATE_FILE 0x08 #define PR_APPEND 0x10 #define PR_TRUNCATE 0x20 #define PR_SYNC 0x40 #define PR_EXCL 0x80 */ /* ** File modes .... ** ** CAVEAT: 'mode' is currently only applicable on UNIX platforms. ** The 'mode' argument may be ignored by PR_Open on other platforms. ** ** 00400 Read by owner. ** 00200 Write by owner. ** 00100 Execute (search if a directory) by owner. ** 00040 Read by group. ** 00020 Write by group. ** 00010 Execute by group. ** 00004 Read by others. ** 00002 Write by others ** 00001 Execute by others. ** */ outputStream.init( file, 0x04 | 0x08 | 0x20, 420, 0 ); var result = outputStream.write( output, output.length ); outputStream.close();alert( "File Updated Successfully ");clear();}
  11. <?xml version="1.0" encoding="UTF-8"?><CONTACTS><CONTACT> <PDE-Identity>N676767</PDE-Identity> <FirstName>Dido</FirstName> <LastName>Lorence</LastName> <gmail/> <yahoo>dido.lorence@yahoo.com</yahoo> <alcatel-lucent/> <URL/> <Facebook-ID/></CONTACT></CONTACTS> How can i get the value of my PDE-Identity and delete all the childNodes including the <CONTACT> using Javascript, DOM Method.Thanks Guys!
  12. You are right! Could you please explain to me how could I check for PDE-Identity element in each contact and get the remaining values.I have a for loop to check for the number of characters of the search item how could I proceed further?Could you explain to me in detail with some code. Thank you very much!
  • Create New...