0

I have a class called Word with these four attributes: text, caseSensitive, matchSimilar and relevance.

I have 10 categories for these words: (allowDetermining,allowHigh,...,denyDetermining,denyHigh,etc.).

I want to be able to store new words on each categories or retrieve all words from some category. How can I do this.

I think the XML structure should be like this, but I don't know if I'm right:

<allowDetermining>
    <word>
        <text>Renato</text>
        <caseSensitive>true</caseSensitive>
        <matchSimilar>false</matchSimilar>
        <relevance>0.75</relevance>
     </word>
</allowDetermining>
<allowHigh>
    ...
</allowHigh>
...

At the moment, I'm using the XMLConfiguration class from Apache Commons Configuration. Any idea of how do this using it? And with another library?

Renato Dinhani
  • 35,057
  • 55
  • 139
  • 199

1 Answers1

0

Is use of XML a requirement, or just your first idea? For persisting configuration data or working sets, JSON (data) or YAML (configuration) might make more sense and be bit easier to do as well. XML works better for its original use case (text markup), but for data-oriented stuff it is quickly falling out of favor, and for good reason.

StaxMan
  • 113,358
  • 34
  • 211
  • 239
  • No, XML is not a requirement. I only think was the right way, but I will take a look at JSON and YAML. – Renato Dinhani Sep 15 '11 at 17:37
  • 2
    "is quickly falling out of favor, and for good reason." is obviously more opinion than fact. Just because Jackson's face is on the $20 bill... ;-) – Ed Staub Sep 15 '11 at 17:41
  • Thanks, I'm using JSON with the Gson lib from Google and worked. Easy to use. – Renato Dinhani Sep 15 '11 at 19:55
  • Ed: yeah, never claimed it's objective, but just check out number of JSON vs XML questions here at SO... XML is dying for data transfer, even if netcraft hasnt yet announce it. :-D – StaxMan Sep 15 '11 at 21:50
  • Renato: congrats! I have my reasons to like Jackson even more, but Gson is a solid lib as well, glad things worked out – StaxMan Sep 15 '11 at 21:51