For example, I just checked in stub code for pivot.xml.Element, which
implements List<Element> and Dictionary<String, String>. The dictionary is for
the attributes (I know that attributes can also have qualified names; I'm just
simplifying since non-qualified attributes are the more common case).
I don't know if we'd ever want to fully implement this class because the W3C
DOM API is so well-established, but I think it is a good example of what can be
done with Pivot's collection interfaces. The nice thing is that, given a
hypothetical pivot.wtk.content.TreeViewElementRenderer, a deserialized XML
document could immediately be dropped in as the model for a TreeView (or any
other data-driven component), in the same way that we can currently take
advantage of JSON data using JSONSerializer.
Now that I think about it, it is actually impossible to use JSONSerializer this
way for tree data, because trees expect the model to contain nested lists of
lists. This type of data structure can't be specified using JSON, because the
nested list data has to be represented as a property of the parent node:
root: {label:"a",
children: [
{label:"b", children: [...]}
{label:"c", children: [...]}
]
}
vs.
<node label="a">
<node label="b"/>
<node label="c"/>
</node>
So, maybe it is worth implementing this class. It wouldn't be difficult to
build using StAX.
Adding support for XPath and other XML APIs would be tougher - though they
could eventually be ported from other DOM-based libraries.