开发者

java dyn parser

Im a novice java-programer, whos trying to create a small java app.

In the program im working on, I want to load the configurations from different ini-files. The basic idea is, that I would have a library containing all the config files, the parser should read all of them and make configurations named after their filenames. The parser should be created to work dynamicly, so it can read different types of configs. example

House.ini 
 -> type0 
 -> id  name  height  witdh  length   price_based_on_dimensions
 -> id1  name1  height  witdh  length   price_based_on_dimensions

These data should be saved 开发者_如何学运维to a config object named config.house. The tricky part is that a different config file, can have its type = type0 but with a different number of attributtes.

I realise that there is no simply solution to this, but any help and or guides to create a dynamic parser is welcome


I'm not really clear on the output you want to produce, but a Java INI parsing library might be a good place to start. For that, you should use ini4j.


Other then ini4j (which is a really good library) I personally prefer to use xml config files. To me they are easier to use and allow for easier configuration

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜