开发者

is there some built in resources for letting the user update an xml file in Android?

I want to keep some information in a xml file, and I want to let the user update that file. Later I will parse and use that information in my app.

Before rolling my own code to create the UI to let the user do this, I was wondering if Android already has something along 开发者_开发知识库the lines I could use?


Android doesn't provide XML generation code itself, but there are plenty of Java resources for it, such as JAXP.


Take a look at using the DOM parser library, that Android has as standard. There are a number of tutorials for this online. For general parsing you might tend to use the SAX parser library due to the fact that it has lower memory requirements, but the DOM parser library appears to contain all of the standard methods that you would use to modify the DOM structure once it's in memory. Just as an example, the Node class has an appendChild() method.

Once you've modified the DOM in memory, hopefully there is some way of persisting the modified Document object for later use (e.g. persist to file), though I have no first-hand experience of doing that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜