On Thu, Nov 30, 2000 at 05:37:04PM -0600, Ken MacLeod wrote:
>
> Just wanted to note that SAX2 modules should go in the namespaces
> SAXDriver::*, SAXFilter::*, and SAXHandler::*.
Thanks. Is there any doc of the differences between the Orchard/SAX2
vs. PerlSAX/SAX1 APIs? I just got Orchard-c and it's perlif built,
and may be changing over to that as our default XML development
environment here soon, so I'm inclined to go that way.
> Otherwise the modules look great. I didn't see mention of reference
> to XML::Writer, which also has a nice script interface for generating
> XML
XML::ValidWriter and XML::AutoWriter are meant to be almost
pure supersets of the XML::Writer API. Meaning that the underlying
primitives are startTag, endTag, characters, etc., but with added
entry points like dataElement( $tag, $content, attr1 => $val1, ... )
and the DTD-based convenience methods & exported functions named
after elements declared in the DTD. The exported functions are for
packages spending most of their statements writing to a "default"
XML file or string.
Both croak if you try to emit non-well-formed or invalid XML, though
the validity checking is not complete (it doesn't check fancy attribute
constraints like enumerations, for instance, though missing required
attributes are caught).
> XML::Writer with
> SAX2 output would likely be what you're thinking of with
> XML::Driver::Elemental.
XML::Writer + SAX{1,2} + methods-named-after-elements, I was thinking.
Leaning towards SAX2 now.
> A feature you might want consider, to more easily support namespaces,
> is to let the caller register prefixes for method and attribute names
> (like 'prefix_local_name'), then output the declarations on the first
> element or as they are defined, and then substitute ':' for the first
> underscore in the element or attribute name.
That sounds like an ideal way to do it, thanks. I don't need it right
away, so it'll have to wait for a bit, but it is upward compatible,
and people can always fall back to using startTag/endTag/dataElement
with colons in tag & attr names if there's a collision between a prefix
and a tag name.
I pondered mapping between Perls' "::" namespace operator and XML's ":"
namespace operator (for lack of a better word), and quickly decided
that the pollution of Perl's namespaces would be ugly. But emitting
a namespaced tag like
DBML::table( $text, attr1 => val1, .... )
$writer->DBML::table( $text, attr1 => val1, .... )
would be cute.
- Barrie