ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> perl-xml
perl-xml
Re: Namespace support in SAX serialisers
by A. Pagaltzis other posts by this author
Oct 15 2005 1:58PM 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 <dom@[...].net>  [2005-10-15 21:45]:
>  A. Pagaltzis wrote:
>  >Well, as I said, it ignores Name completely.
>  
>  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.

Well, thatâ??s why I asked if there is any specification about
this. It would be nice if we could avoid having every module
author have to decide how his module should infer missing bits
from other missing bits.

>  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.  :-)

Thatâ??s why it should be solved once in the serialiser instead of
over and over in the applicationsâ?¦ :-)

It isnâ??t really *that* difficult (though I donâ??t know how complex
things are in Genx), but itâ??s certainly real easy to screw it up.

>  Could you give me the sequence of events that you're sending so
>  that I can see what's going on?  Thanks.

At the beginning of processing,

	$h-> start_document();
	$h-> start_prefix_mapping( {
        Prefix =>  '',
        NamespaceURI =>  ATOM_NS,
    } );
	$h-> start_element( {
		Name      =>  'feed',
		LocalName =>  'feed',
		Prefix    =>  '',
		NamespaceURI =>  ATOM_NS,
	} );

and then later

    my $element = {
        Name      =>  'div',
        LocalName =>  'div',
        Prefix    =>  '',
        NamespaceURI =>  XHTML_NS,
    };
    $h-> start_prefix_mapping( {
        Prefix =>  '',
        NamespaceURI =>  XHTML_NS,
    } );
    $h-> start_element( $element );
    # ...
    $h-> end_element( $element );
    $h-> end_prefix_mapping( {
        Prefix =>  '',
        NamespaceURI =>  XHTML_NS,
    } );

and itâ??s when I emit the `div`â??s start_element event that
::SAXWriter crashes and burns.

Incidentally I wonder if it the SAX spec (or Perl-SAX spec)
requires those start_prefix_mapping events of if it wouldnâ??t be
the explicit `Prefix` given for the start_element event shouldnâ??t
be enough to cause the serialiser to emit the requisite xmlns
attribute, given that the prefix is currently mapped to a
different namespace than the one given.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just-> another->Perl->hacker;
_______________________________________________
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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved