I once had a colleague that told me that a properties file can do 97% of what an xml file does. Sure xml files have attributes (like leaves of a branch) but an xml source by the name of w3schools recommends only use of attributes as meta-data to describe the xml tag itself: for instance, the "id" attr.
So, I suppose the extra 3% comes from a forced "integrity" constraint on the relationship of data with the same namespace, using a spatial relationship more openly apparent in xml. For example,
a.b=The Joker
a.b.c=Batgirl
a.b=Batman
a.b=Superman
a.b.c=Supergirl
Using properties, there is no constraint relationships like xml (for ex: alike superheroes or originals)
[a]
[b]Joker[/b]
[b]
[c]Batgirl[/c]
[/b]
[a]
--or--
[a]
[b]Batman[/b]
[b]
[c]Batgirl[/c]
[/b]
[/a]
The difference in xml is the encompassing syntax which excludes data outside the descendant structures while properties only has a time-line "before" or "after" relationship. so in the above property example, when does one decide to take it above for the Batman-Batgirl relationship and when does it decide bottom for the Superman-Supergirl example; and what if i place "a.b=The Joker" on top. Does Batgirl become a bad girl?
If an "after" relationship is maintained, then Batgirl would not be partnered with Batman (creating a possible & separate memory-intensive branch) as with Superman-Supergirl if constraints are Not enforced by XML encompassing.
I suppose one could do this to encompass:
a.b=Batman
a.b.c=Batgirl
a.b=Superman
but then what is the text value of a.b now? Batman or Superman? It's workable but messy syntax.
and what about:
a.b=Batman
a.b.c=Batgirl
a.b=Superman
a.b.c=Kypronite
a.b=Lux Luther
so is it Batman-Batgirl-Superman or Superman-Kypronite-Lux Luther?
One could do this but then this is becoming more like xml >
a.b=Batman
a.b.c=Batgirl
a.b=Superman
a.b=Superman2
a.b.c=Kypronite
a.b=Lux Luther
*This assumes your implementation allows for processing of values with the same property names. (ie. ini4j)
[So if you have hierarchical data with duplicate namespaces, xml is the one for you]
Tuesday, May 11, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment