Re: XML Parrot Was: XML::Rules tagspec
"Jenda Krynicky" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
From: Maurice Mengel <[email protected]> > not really related to your posts, but also not completely unrelated: > > I looked up XML::Rules on CPAN and followed the links in the > documentation. On this way I got to the idea of treating XML as lisp > on perlmonks.org. Now, I wonder if one should write a grammar for XML > in parrot. What would this mean? Would this be similar to the lisp > idea? Would this be helpful? Would this serve as a parser? Any ideas > on this? I think it would be similar and it might work fine (except that you'd have to take care of XML entities etc. which is something I leave to the XML::Parser below XML::Rules). I do not know enough about Parrot to tell how it's gonna work. When I experimented while designing XML::Rules I ran into the problem that <xml> <foo> <bar>1</bar> <bar>3</bar> <bat>hello</bat> </foo> </xml would map nicely to (xml (foo (bar 1) (bar 3) (bat 'hello') ) ) but what about atributes? With attributes you no longer have (function and a list of things), you rather have (function {hash} and a list of things), and then you'll no longer be content with being able to insert the results of the function application into the (list of things), you'll want to add to the hash as well. So, if we returned to the Perl5 syntax, it will not be enough to turn the XML into something like xml( foo( bar(1), bar(3), bat('hello'), ) ) or with attributes to xml( {}, foo( {id => 0} bar( {name => 'blah'}, 1), bar( {name => 'blih'}, 3), bat('hello'), ) ) It would not be convenient. Check the section of the XML::Rules docs that starts "The possible return values of the subroutines are" ... as you can see there's quite a bit of work to do with the return values before I can evaluate the function to which the parent tag got mapped. I don't know, try and see where do you end up :-) Jenda ===== [email protected] === http://Jenda.Krynicky.cz ===== When it comes to wine, women and song, wizards are allowed to get drunk and croon as much as they like. -- Terry Pratchett in Sourcery _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs