Android Question Edit xml file

FabioG

Active Member
Licensed User
Longtime User
Hello,

I have an xml file already created
I need to change some values inside the xml file

you have a suggestion to do this?

Thanks
Fabio
 

FabioG

Active Member
Licensed User
Longtime User
Thanks, but

this tells you how to read a value
and no how to write a value

any other ideas?
 
Upvote 0

FabioG

Active Member
Licensed User
Longtime User
Thanks again

know sqlite
but unfortunately I do not think it is feasible
because it is a file of a program already exists, I can only change the single value.

be sure to read the xml file as a string and use .Replace to change the value?
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
In theory my XOM library can open, modify and then save an XML document.

In practice i couldn't work out how the native java XOM library could do such a task - so was unable to know which java methods to include in my b4a XOM wrapper library.
I used the XMLBuilder library instead :).

The java XOM tutorial can be found here: http://www.xom.nu/tutorial.xhtml.

@FabioG If you knew which java XOM methods and objects you need to use i could add them to the b4a XOM library.

Martin.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
@FabioG

Can you follow my b4a XOM example project (in the link above) and load your XML file?
Can you then parse some or all values - just iterate through some XOMElement objects and log their values?

If so we should be able to work out what to do next in order to modify XOMElement values and then save the modified XOMDocument.

It'd be more elegant to use XOM to do all three tasks: open, modify and save.

It'd probably be quicker to use either the XOM or b4a XmlSax library to open the XML document and read it's values into b4a objects - Maps and Lists etc - modify the values and then use the XMLBuilder to save the modified values to a new XML document.

Martin.
 
Upvote 0

FabioG

Active Member
Licensed User
Longtime User
Thanks warwound

sorry but I do not understand how they work / example

I temporarily solved with a Replace
I know that is not a good method, but for now it works

I have not capit ogli examples for the library specified by you

Thanks anyway
 
Upvote 0
Top