I was talking to Mark Fowler yesterday and XML::Genx came up. He had a couple of good points:
- It’s not absolutely clear in the documentation that any valid Perl string will work correctly (be it UTF-8 encoded or not). I need to double check the tests for this and amend the docs.
- The API is still fairly horrible. It mirrors the C api almost exactly, but this feels very odd as a Perl programmer. I need to have a think about what would be better. Ideally, I’d like something more like ruby’s builder. In fact, I actually wrote something similar to that before (XML::SAX::Builder), but that uses SAX, which is too slow in Perl.
I really appreciate the feedback. Apart from Aristotle, it’s the only feedback I’ve had since I released it.
If I can figure these out, I should probably slap a 1.0 on it.
I also reckon I should do a talk on “Why we need another XML writer”. There are quite a few on CPAN already and I should say why I wrote another one…
2 replies on “XML::Genx Plans”
A nice XML builder API would be excellent. Above all I’d love smooth namespace support.
The support in XML::SAX::Builder is very awkward.
In XML::Writer it’s smoother, but that isn’t saying much because the API in general is rather verbose.
In Ruby’s builder, it’s concise but really un-XMLish. The meaning of the method name flips from element name to prefix string when you pass a symbol, which looks funny to me despite the syntactic cleverness it enables. Worse, though, it promotes use of concrete prefixes. I want to associate namespaces with nodes symbolically.
Thanks for the input—that’s really helpful. I agree, XML::SAX::Builder’s namespace support is really awkward, but more than anything else, it’s a by product of the implementation (blessed closures).
I’ll have a nose around and see what else is out there. It needs to be solved decently…