OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple SAX2 Proposal, v3.



First of all I want to say I like this version of proposal.

Ad $name/{}$name: the first way would allow to keep SAX2 generators 
compatible with SAX1, that's the only benefit I can see. I think this 
"benefit" can be traded off against a consistency of the second way.

But I have another question. start_cdata() has an empty argument in 
current binding and data itself is provided by another call of 
characters(). What is reason for this? Passing {Data  => $data}directly 
in start_cdata() would make the communication between SAX and DOM more 
straightforward and just one function would be called instead of three. 
Am I missing anything?

Petr

Matt Sergeant wrote:

>This time, much smaller changes from the current PerlSAX2 proposal...
>
>Following discussions with Ken MacLeod on IRC and thinking about what we
>might need to do with attributes in the future (i.e. add more properties to
>them), here's what I've come up with:
>
>1. Rather than Attributes being keyed by [$ns, $local] or $qname, depending
>on context, they are just plain hashrefs keyed by "{$ns}$local". The
>so-called James Clark notation. The values are hashref objects representing
>the attribute nodes, with Prefix, Name, LocalName and NamespaceURI
>properties, much like the element nodes.
>
>Gone are InScopeNSMap (it's pointless if you have attributes having their
>own Prefix and NSURI properties) and autovivication issues. Also gone is my
>start/end ns events, as they were already in the advanced part of the
>PerlSAX2 proposal.
>
>This is a very simple change to the current SAX2 spec, but makes it
>infinitely easier for developers to write SAX2 generators.
>
>It's a little more complex to use than the previous proposal of mine, in
>that to get at the value you have to access the Value property. But this is
>no more complex than having to access the Data property to get at the text
>being passed to the characters() callback.
>
>The downside, I suppose, is that keys %{$e->{Attributes}} is pretty
>meaningless except to iterate over the attributes (in which case you should
>probably just use values()), but that's a small price to pay.
>
>Here's your element node with this scheme:
>
>  {
>	Name => "item",
>	LocalName => "item",
>	NamespaceURI => "http://example.com/a",
>	Prefix => "",
>	Attributes =>
>		{
>		"{http://example.com/b}id" => 
>			{ Name => "b:id",
>			  LocalName => "id",
>			  Prefix => "b",
>			  NamespaceURI => "http://example.com/b",
>			  Value => "352"
>			},
>		"flirble" =>
>			{ Name => "flirble",
>			  LocalName => "flirble",
>			  Prefix => "",
>			  NamespaceURI => "",
>			  Value => "wangle"
>			},
>		"blurb" =>
>			{ Name => "blurb",
>			  LocalName => "blurb",
>			  Prefix => "",
>			  NamespaceURI => "",
>			  Value => "Hello World"
>			},
>		},
>  }
>
>Matt.
>
>________________________________________________________________________
>This email has been scanned for all viruses by the Star Internet Virus Screen.
>The service is provided in partnership with MessageLabs, the email security company.
>For more information on a higher level of virus protection visit www.star.net.uk
>________________________________________________________________________
>_______________________________________________
>Perl-XML mailing list
>Perl-XML@listserv.ActiveState.com
>http://listserv.ActiveState.com/mailman/listinfo/perl-xml
>

-- 
Petr Cimprich
Ginger Alliance
www.gingerall.com