Re: Namespace support in SAX serialisers
by Robin Berjon other posts by this author
Oct 17 2005 3:04AM messages near this date
view in the new Beta List Site
Re: Namespace support in SAX serialisers
|
Re: Namespace support in SAX serialisers
& XSLT Dominic Mitchell wrote:
> What do you think it should do? I reckon:
>
> * Look at LocalName first and then fall back to Name if it's not present
> (ignoring the prefix on Name).
>
> * Look at Prefix first and if not present, divine it from Name.
Yes, and it should auto-generate prefixes when none are provided (even
if it makes things look ugly).
Ideally, this sort of functionality which turns a non-conformant stream
into a conformant one should be abstracted into a separate module (a
filter) so that other pieces of the SAX infrastructure could reuse it.
XML::SAX::Writer would then return that filter instead of itself from
new() (that's already what it does with another filter). This prevents
everyone from reinventing this wheel, no matter how simple it may seem
to be.
> I've just been looking at this part of Genx recently in an attempt to
> understand quite how it works (I'm attempting a Java rewrite in order to
> bone up on my java skills). I'll have to say that I'm still figuring
> out what's going on in there. It's certainly given me new respect for
> the complexity of namespaces. :-)
Rule 0 is if you think namespaces are complex, you're very, very
probably reading too much into them.
That being said, *writing* XML correctly is a more complex task than
people often realize. It's not at all intractable, but there's a bunch
of small catches that will get you at some point. Most XML writers have
some parts that are hard to understand at first but make sense if you
walk them through writing out something with a debugger. When they don't
have slightly strange bits, they'll write incorrect XML ;)
> Yes; you certainly should be able to omit the Prefix if required. As
> far as I can see you should be able to use LocalName and NamespaceURI
> and nothing else. Prefix's should be honoured if supplied, but they
> shouldn't be mandatory.
Ideally you should only need either of:
- namespace and local name (prefix gets auto-generated)
- prefix and local name (assuming the prefix mapping events are right)
- name (with the same assumption)
and of course anything that gives you more information than any of the
above.
--
Robin Berjon
Senior Research Scientist
Expway, http://expway.com/
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
A. Pagaltzis
Petr Cimprich
A. Pagaltzis
Petr Cimprich
A. Pagaltzis
Robin Berjon
Petr Cimprich
Dominic Mitchell
A. Pagaltzis
Robin Berjon
Dominic Mitchell
Robin Berjon
A. Pagaltzis
Robin Berjon
A. Pagaltzis
Robin Berjon
A. Pagaltzis
A. Pagaltzis
Dominic Mitchell
Robin Berjon
Dominic Mitchell
A. Pagaltzis
Dominic Mitchell
Dominic Mitchell
|