I am creating android app. I want to use xml file just to store a little amount of data for short period of time.. I am able to read xml using ajax.get() method file but not able to write xml.. Please help me to do so..
Asked
Active
Viewed 661 times
-2
-
[Create a Minimal, Complete and Verifiable question](http://stackoverflow.com/help/mcve) Could be great – Essex Jul 06 '16 at 12:07
-
can you suggest me which ajax method should i use to update xml file – Ajay Mestry Jul 06 '16 at 12:10
-
Please read my above answer – Essex Jul 06 '16 at 12:11
-
i am not interested in reading whole bunch of instructions.. just a short help – Ajay Mestry Jul 06 '16 at 12:13
-
If you aren't interested in research or reading...why should we be interested in helping? – charlietfl Jul 06 '16 at 12:18
-
I totally agree with you.. But i am running out of time.. – Ajay Mestry Jul 06 '16 at 12:25
1 Answers
1
If you want to store a little amount of data and you are using cordova, you could use get and set local storage:
localStorage.setItem("lastname", "Smith");
and
var agentSmith=localStorage.getItem("lastname");
as w3school says:
With local storage, web applications can store data locally within the user's browser.
but if you want to use xml, you could do:
var v = new XMLWriter();
v.writeStartDocument(true);
v.writeElementString('test','Hello ');
v.writeAttributeString('foo','bar');
v.writeEndDocument();
console.log( v.flush() );
and obtain:
<?xml version="1.0" encoding="ISO-8859-1" standalone="true" ?>
<test foo="bar">Hello World</test>
-
Thanx for the answer bro.. I really appreciate.. But I am looking for the xml way only.. – Ajay Mestry Jul 06 '16 at 12:29
-