This question is locked. New answers and comments are not allowed.

THIYAGARAJAN
Top achievements
Rank 1
THIYAGARAJAN
asked on 15 Apr 2013, 05:51 AM
Create and save a XML file using jquery, can any one give suggestions for this, how to do in mobile app.
9 Answers, 1 is accepted
0

Jan-Dirk
Top achievements
Rank 1
answered on 15 Apr 2013, 10:15 AM
As far as I know you can't create an xml file on 'disk' (or other media) with JavaScript, only in memory.
0

THIYAGARAJAN
Top achievements
Rank 1
answered on 15 Apr 2013, 10:44 AM
Can u say, how to create in memory in javascript/jquery. would you any site reference for this..
0

Prabu
Top achievements
Rank 1
answered on 15 Apr 2013, 10:46 AM
can we write values to xml file using jquery?if possible give me examples.
thanks.
thanks.
0

Jan-Dirk
Top achievements
Rank 1
answered on 15 Apr 2013, 10:49 AM
http://stackoverflow.com/questions/7152064/how-to-create-xml-file-with-jquery
0

THIYAGARAJAN
Top achievements
Rank 1
answered on 15 Apr 2013, 11:15 AM
can you say, how to save xml file in memory, can you give any reference for that
0

Jan-Dirk
Top achievements
Rank 1
answered on 15 Apr 2013, 11:52 AM
I am sorry, but I haven't used it myself.
Please use Google :)
The 4th reply (by 'jiggy') in the page I linked to earlier gives you some pointers where to search for.
Please use Google :)
The 4th reply (by 'jiggy') in the page I linked to earlier gives you some pointers where to search for.
0

Deepan
Top achievements
Rank 1
answered on 10 Jan 2014, 09:50 AM
Hi, guys i am working in Jquery mobile
it is possible to store xml file using jquery in both Android and Iphone
var content = '<?xml version="1.0" encoding="UTF-8"?>';
content+='<logins>';
content +='<properties>'
content +='<username>something</username>'
content +='<password>something</password>'
content +='</properties>'
content +='</logins>';
var storedFileName = "login.xml";
var storedContent = content;
StoreLocalXML();
/* Create Local Xml Files */
function StoreLocalXML() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, Fail);
}
function gotFS(fileSystem) {
// create dir
fileSystem.root.getDirectory("folderName", {
create: true,
exclusive: false
}, gotDirEntry, Fail);
}
function gotDirEntry(dirEntry) {
// create file
dirEntry.getFile(storedFileName, {
create: true,
exclusive: false
}, gotFileEntry, Fail);
}
function gotFileEntry(fileEntry) {
fileEntry.createWriter(gotFileWriter, Fail);
}
function gotFileWriter(writer) {
writer.onwrite = function (evt) {
console.log("write completed");
};
writer.write(storedContent);
writer.abort();
}
function Fail(error) {
console.log(error.code);
}
it is possible to store xml file using jquery in both Android and Iphone
var content = '<?xml version="1.0" encoding="UTF-8"?>';
content+='<logins>';
content +='<properties>'
content +='<username>something</username>'
content +='<password>something</password>'
content +='</properties>'
content +='</logins>';
var storedFileName = "login.xml";
var storedContent = content;
StoreLocalXML();
/* Create Local Xml Files */
function StoreLocalXML() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, Fail);
}
function gotFS(fileSystem) {
// create dir
fileSystem.root.getDirectory("folderName", {
create: true,
exclusive: false
}, gotDirEntry, Fail);
}
function gotDirEntry(dirEntry) {
// create file
dirEntry.getFile(storedFileName, {
create: true,
exclusive: false
}, gotFileEntry, Fail);
}
function gotFileEntry(fileEntry) {
fileEntry.createWriter(gotFileWriter, Fail);
}
function gotFileWriter(writer) {
writer.onwrite = function (evt) {
console.log("write completed");
};
writer.write(storedContent);
writer.abort();
}
function Fail(error) {
console.log(error.code);
}
0

tra12
Top achievements
Rank 1
answered on 17 Jun 2014, 03:57 PM
Hi,
is it possible to use this code for an android app example.
actually i am using phonegap and i have to save some data in xml.
to read from xml with jquery is not a problem, only to save....
thanks in advance
regards,
tra12
is it possible to use this code for an android app example.
actually i am using phonegap and i have to save some data in xml.
to read from xml with jquery is not a problem, only to save....
thanks in advance
regards,
tra12
0
Hi tra12,
You should be able to use the Cordova File API to write your data in an xml file and save it in the file system of a device. The code bellow also demonstrates this API so you can definitely use it and you can also take a look at the AppBuilder File Sample to get started.
Regards,
Tina Stancheva
Telerik
You should be able to use the Cordova File API to write your data in an xml file and save it in the file system of a device. The code bellow also demonstrates this API so you can definitely use it and you can also take a look at the AppBuilder File Sample to get started.
Regards,
Tina Stancheva
Telerik
Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!