Re: Accessing Transformiix library from C++
Axel Hecht <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | Another Netscape Collabra Server User |
| Message-ID | <[email protected]> |
Allan Beaufour wrote: > Peter Van der Beken wrote: > >> Allan Beaufour wrote: >> >>> Axel Hecht wrote: >>> >>>> You can use DOM Level 3 XPath, esp nsIDOMXPathEvaluator, which is >>>> implemented by html and xml documents. See that interface and its >>>> friends over in mozilla/dom/public/idl/xpath >>> >>> >>> I know. I am aware that I need to access it directly. I am already >>> using the "normal" and exposed API for other things. >> >> >> Why do you need the lexer specifically? > > > I need two things: > 1) Get "dynamic function usage" in an expression > > That is, find out whether and expression has any functions in it that > would change the result from call to call, e.g. "now()". > > 2) Get all nodes that an expression depends on > > That is all nodes that influences the expression, not the node set > returned from an Evaluate(). I need to know that "thing[at=../other + > ../another]" depends on "../other" and "../another" (and "thing" of > course). > > The first one is fairly easy done with the lexer. The second one is more > tricky, and could probably be done more easily done by instrumenting one > or more evaluate()-functions? So, what you need is something like the stuff that Jonas implemented in his xpath optim patch. I wonder if you could go for a few simple kinds of dependencies / or-all-of-the-doc. And get that exported to XPCOM. Anyway, we should know how often you need this optimization, and for what. Right now, this looks like "it would be simple for me if we had this", but this should balance in total. These requirements smell like "check if I have to reevaluate if a doc changes". How often does that happen? And, is this a validation thing or do you need to display up-to-date results of an xpath expression only? >> Sure, you could probably manually load the library but that sounds >> like an ugly solution, so if you let us know more about why/how you >> need the lexer, maybe we could look for a better solution together. > > > No, I know that it wont win a beauty contest :) But I feel that it would > be stupid not to take advantage of the existing code in the Mozilla > tree, so I'm looking for a solution using Transformiix. So I would very > much appreciate any help. This is not about a beauty contest, this is about you following XPCOM rules. Completely different game. > While we're at it: Another thing we need is to evaluate expressions > where we can set contextSize and contextPosition. As far as I can see it > is a question of changing/modifying the evaluation context? The problem > is that I get kind of lost in the Transformiix code from time to time :) Oh, you too? Yell, maybe somebody finds you. Or rather don't, that somebody or -thing might have you for breakfast ;-). But it shouldn't be too hard to expose such a feature. Are you sure that you couldn't just make XPath create that context and go from there? We'd like to see a sample here to check what's really required. After all that's said and done, we need to make sure that our API doesn't turn into a cryptic nightmare of things that only a few XForms hackers understand. Much more than it already is :-(. Axel