Hello all,
Here's hoping I don't offend anyone in this list with a post using "XML" in
the title. :-D
There's a good reason, though: I've been working for a while on a generic
XSLT-driven XML-based document viewer called XMLEye, to which pretty much
any script that can print to standard output can plug into (i.e., Perl
programs). I made a while ago a plugin script (and some XSLT stylesheets) so
it could open YAML files. This way, XMLEye can be customized to browse
through some interesting YAML/JSON formats in the future, like Firefox
bookmarks or Django fixtures.
What this script does is basically parse the YAML 1.1/JSON file using the
YAML::XS Perl binding for libyaml and output the resulting data structure as
an XML file. The format is heavily inspired from the YAXML binding, with
some refinements. It has a suite of tests which perform a roundtrip
YAML->XML->YAML transformation (using an improved version of the YAXML XSLT
stylesheet) and make sure that parsing the original and regenerated YAML
files results in equal data structures.
Anchors are detected by filtering multiple references to the same memory
address. I don't know how to detect which one contained the original anchor
definition from the Perl data structure itself, but I think that's
irrelevant. Is it, though?
I've got more information on XMLEye and YAXML::Reverse under
http://wiki.shoyusauce.org. From there, you can get to the forge, which has
links to the SVN repository, some code snapshots and Ubuntu packages. I
recommend using the SVN version: I still haven't updated the Ubuntu packages
so they get YAML 1.1/JSON support rather than just YAML 1.0.
I'd like to hear your opinion on the way this is handled. Do you think I'm
missing something?
Cheers,
Antonio
|