From: Erik V. <eri...@hc...> - 2007-09-30 18:38:20
|
I have encapsulated parsing the new file Games.xml into a new class GamesInfo. In this class I have attempted to work towards an easier way of traversing the DOM tree. In fact there are now two completely interchangeable versions of GamesInfo. In the first one I have done away with all the DOM objects, except Element. All NodeLists and NamedNodeMaps are now hidden in new XmlUtils methods. In the second one (GamesInfo2) I have also gotten rid of Element, replacing it by a new class rails.util.Tag, which hides all DOM objects, including Element. Attributes and inner tags are now available through simple getters. This version makes XmlUtils redundant (except one method: findElementInFile(), which we can as well move to somewhere else). Both versions incorporate automatic application of chosen games options by interpreting the <IfOption> tags that already exist in some game XML files. GamesInfo only does that for optional attribute values. GamesInfo2/Tag also allows optional inner tags (not yet used). Both ways work equally well, and the code of both GamesInfo versions is very much alike. I prefer the second version, which requires an additional class (Tag), but in return makes XmlUtils obsolete. Any opinions? Erik Vos |