|
[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: attribute order (RE: Syntax Sugar and XML information models)
On Fri, 30 Mar 2001, Tim Bray wrote:
> At 08:26 AM 30/03/01 -0500, Simon St.Laurent wrote:
> >Is there some kind of processing advantage for _parsers_ (not applications)
> >to report attribute values in any sequence other than their original sequence?
>
> Only instance I can think of is in perl, in one of the interfaces
> through XML::Parser to expat, you can arrange to get a callback
> for each start tag where the attributes are passed in as a hash
> keyed by name in the obvious way. So the order isn't changed,
> but it's effectively lost. -Tim
Not true actually, XML::Parser passes them through as an array, it's just
that assigning that to a hash loses the order. Try:
sub parse_start {
my ($e, $tag, @attribs) = @_;
print "Tag: $tag\n";
while (@attribs) {
my ($key, $value) = splice(@attribs, 0, 2);
print "Attrib: $key=$value\n";
}
}
--
<Matt/>
/|| ** Founder and CTO ** ** http://axkit.com/ **
//|| ** AxKit.com Ltd ** ** XML Application Serving **
// || ** http://axkit.org ** ** XSLT, XPathScript, XSP **
// \\| // ** mod_perl news and resources: http://take23.org **
\\//
//\\
// \\
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|
|||||||||

Cart








