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: 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  **
     \\//
     //\\
    //  \\