Introduction
In this article I am going to discuss the various posibilities of working with XML files for storing your own custom configurations. XML files are ideal for doing this sort of thing for a number of reasons...They absorb easily into Android Object Models (AOM) using the XML DOM or SAX parsers. As we'll soon see, in a future expansion of this article, XML configurations could also be generated and ingested into your objects via the SIMPLE method, which I have briefly touched on in my previous article.
.NET technique for converting large text files into XML structures intended for Android objects
XML does not even require a physical storage location on the Android device! This implies your configurations can be served on the fly through HTTP responses from a webservice or cloud service.
Just for the sake of an illustrative example, we can have one or more XML configuration files stored in the ASSETS folder initially and later modify these default configurations and have them moved to the device SD Card. This way, the end user will always have a default configuration to fall back on! I generally give end user the option to restore back to "the factory configuration" or more commonly refered to as "default config". What this simply translates to, is a one-step approach of deleting the SD Card config and the software will do all the smart checking for you to see if the user reverted back to default. Once the default config is modified, it gets copied back to the SD Card. The user always has a copy of the original footprint and that is never lost. It could actually come from a config server if so desired. I will discuss this attractive method in more detail later on. I also confess, this dual method is the way I generally prefer to work with XML config files rather than store configuration in alternate databases. Overall, I find XML to be my method of choice for storing meta-data, configuration specific data and as we saw in the previous article, I even use it in my e-reader application to absorb entire e-book sections into my baseline AOM. Please see my last article for further clarification on what this XML data store means. Please make sure to experiment with your own unique implementations as well, it will only help you master this technique...
In this article I am going to discuss the various posibilities of working with XML files for storing your own custom configurations. XML files are ideal for doing this sort of thing for a number of reasons...They absorb easily into Android Object Models (AOM) using the XML DOM or SAX parsers. As we'll soon see, in a future expansion of this article, XML configurations could also be generated and ingested into your objects via the SIMPLE method, which I have briefly touched on in my previous article.
.NET technique for converting large text files into XML structures intended for Android objects
XML does not even require a physical storage location on the Android device! This implies your configurations can be served on the fly through HTTP responses from a webservice or cloud service.
Just for the sake of an illustrative example, we can have one or more XML configuration files stored in the ASSETS folder initially and later modify these default configurations and have them moved to the device SD Card. This way, the end user will always have a default configuration to fall back on! I generally give end user the option to restore back to "the factory configuration" or more commonly refered to as "default config". What this simply translates to, is a one-step approach of deleting the SD Card config and the software will do all the smart checking for you to see if the user reverted back to default. Once the default config is modified, it gets copied back to the SD Card. The user always has a copy of the original footprint and that is never lost. It could actually come from a config server if so desired. I will discuss this attractive method in more detail later on. I also confess, this dual method is the way I generally prefer to work with XML config files rather than store configuration in alternate databases. Overall, I find XML to be my method of choice for storing meta-data, configuration specific data and as we saw in the previous article, I even use it in my e-reader application to absorb entire e-book sections into my baseline AOM. Please see my last article for further clarification on what this XML data store means. Please make sure to experiment with your own unique implementations as well, it will only help you master this technique...
Read More....
Stay tuned to my blog, twitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.
Stay tuned to my blog, twitter or facebook to read more articles, tutorials, news, tips & tricks on various technology fields. Also Subscribe to our Newsletter with your Email ID to keep you updated on latest posts. We will send newsletter to your registered email address. We will not share your email address to anybody as we respect privacy.
No comments:
Post a Comment