For all the friendly freaks out there writing XPath implementations on streams, I think you might be quite interested in reading about Xaos (pronouced Chaos, it's the ancient Greek work and is normally spelt χαος -- I thought that should be χαως but I could be completely off), standing for XML Analysis, Optimization, and Stuff. Its most important feature is an algorithm to convert an XPath containing upward axes to one that only contains descending ones, thus making it a lot easier to work on a stream using a rather simple automaton.
PS: the new use.perl feature that does Unicode => &#xxx; conversion is cool
Cool, thanks! (Score:1)
Will take a look at that toolkit when next I dive in to EventPath implementation (see XML::Filter::Dispatcher [cpan.org] for that, those of you interested in streaming XPath implementations).
Thanks for the pointer.
- Barrie
Re:Cool, thanks! (Score:2)
Somehow I thought you would read this :) As for XPath-on-streams freaks, well, if it doesn't have to include implementer then you can count me in. You can also count the guy working next door from me that wants to do that kind of thing for our Publisher software. Then you have the STX guys as well. And prolly a number of other people, lo! we're a crowd, lets take over the world!
It sure would be nice having an optimized matcher in XFD, especially one that can handle all of XPath on a stream.
-- Robin Berjon [berjon.com]
Re: STX (Score:1)
EventPath is a superset of XPath which buffers events as necessary for in-order delivery in the event of possibly out-of-order matching expressions like /a[b]/c. And it gets most things correct :). This Xaos stuff might be a better way of implementing it, however; X::
Re: STX (Score:2)
Oh, I remember STX as a subset of XPath, haven't looked that way in ages. Xaos immediately reminded me of XSD as what it does to match seems quite similar, notably related to what they call Total Matching (I think you do something quite similar, but I haven't thought that through yet). You could probably go indeed faster with a state machine, and I've been wondering if it's possible to see a stream as a b-tree as explained in Murata's [coverpages.org] (can't find the PPT, it contained graphics that made it a lot clearer)
-- Robin Berjon [berjon.com]
Re:Cool, thanks! (Score:2)
Hand raised, waving frantically
It has been in my todo list for ever... maybe between ripping the XPAth grammar from XML::Filter::Dispatcher and this I can write something really cool for XML::Twig.
I'd bet on you getting there first though ;--(
mirod
Re:Cool, thanks! (Score:2)
Couldn't you go at it the lazy way and build that Twig functionality layered over XFD?
-- Robin Berjon [berjon.com]
Re:Cool, thanks! (Score:1)
Those two will print out hashes (returned by xvalue()) for each <b> and <c> in the root element. Mind you, this isn't meant to look pretty or replace XML::TWIG, it's meant to provide limited TWIG-like functionality in the X::F::D environment so you can conveniently slurp a tw
Re:Cool, thanks! (Score:1)
Sorry,
Barrie
it's all greek to me... (Score:1)
Re:it's all greek to me... (Score:2)
Ah cool, many thanks for looking it up. My greek dates back to when I was fourteen or fifteen, it's hazy at best. Going back home I looked around to check, with a vague intuition of where I would find it. It's in a letter from a girlfriend dating back to when I had greek courses, and whe quotes Hesiod's "en arkhe khaos en". Rereading it, it's hard to tell in her handwriting if it's an ο or an ω, which leads me to believe that maybe she didn't remember as she wrote and scrambled it on purpose (I
-- Robin Berjon [berjon.com]