On Apr 7, 2008, at 7:43 AM, doekman wrote:
> I have two other ideas:
> - define types via xml scheme (xsd)
> - do something with xslt-parameters
> I favour the second one, but I haven't actually thought about how to
> implement it.
I'm not familiar with XSD at all. I'm not sure what support it has
for semi-structured schemas, since the advantage XML2JSON has right
now is that you can define schemas as you go, to fit the data.
I don't think attributes should be allowed to be used for actual
data. Which is why I think using attributes for out-of-band
information like type is a good idea. It lets you define the JSON on
the fly. It also has the good property that you set the data-type at
the same time you create the data instead of multiple places.
Using xslt-parameters is annoying because you'll have to either
generate an XPath (which can be hard, programatically, since you may
not now how far down the tree you are) or via some other mechanism
which I haven't thought of yet.
I realize that attributes are used in the JS code, but I'm not as
interested in the JS code. I'll not break it but I don't see the use
case for it that JSON won't provide. Worst case, you can generate
JSON and have the JS suck that in.
Ciao!