javascript - how to read & write external xml file in apache cordova? -
i creating android app. want use xml file store little amount of data short period of time.. able read xml using ajax.get() method file not able write xml.. please me so..
if want store little amount of data , using cordova, use , 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 user's browser.
but if want use xml, 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>
Comments
Post a Comment