F FabioG Active Member Licensed User Longtime User May 29, 2014 #1 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
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
LucaMs Expert Licensed User Longtime User May 29, 2014 #2 http://www.b4x.com/android/forum/threads/xml-parsing-with-the-xmlsax-library.6866/ Upvote 0
F FabioG Active Member Licensed User Longtime User May 30, 2014 #3 Thanks, but this tells you how to read a value and no how to write a value any other ideas? Upvote 0
NJDude Expert Licensed User Longtime User May 30, 2014 #4 To do that, you will have to parse the XML, make the modifications you need and re-create it, you can use the XMLBuilder library. Upvote 0
To do that, you will have to parse the XML, make the modifications you need and re-create it, you can use the XMLBuilder library.
warwound Expert Licensed User Longtime User May 30, 2014 #5 Look here:http://www.b4x.com/android/forum/threads/anyone-using-xmlbuilder-with-b4a.16277/ Martin. Upvote 0
F FabioG Active Member Licensed User Longtime User May 30, 2014 #6 Thanks! having a file with hundreds of values, perhaps it is a very complex ? Upvote 0
LucaMs Expert Licensed User Longtime User May 30, 2014 #7 Probably thinking about it "a bit '", you could find a way to use a SQLite db in which to import / export XML. Upvote 0
Probably thinking about it "a bit '", you could find a way to use a SQLite db in which to import / export XML.
LucaMs Expert Licensed User Longtime User May 30, 2014 #8 http://www.b4x.com/android/forum/threads/best-way-to-move-large-data-from-xml-to-sqlite-db.29389/ Upvote 0
F FabioG Active Member Licensed User Longtime User May 30, 2014 #9 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
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?
warwound Expert Licensed User Longtime User May 30, 2014 #10 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
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.
F FabioG Active Member Licensed User Longtime User May 30, 2014 #11 Unfortunately, I do not know this I'm trying with a simple Replace for Strings Upvote 0
warwound Expert Licensed User Longtime User May 30, 2014 #12 @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 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.
F FabioG Active Member Licensed User Longtime User May 31, 2014 #13 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
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
LucaMs Expert Licensed User Longtime User May 31, 2014 #14 That "I have not capit ogli examples"... me fa pensa' che sei italiano Upvote 0
F FabioG Active Member Licensed User Longtime User May 31, 2014 #15 LucaMs, lol gli scherzetti di Google Translate Upvote 0