Question about StaticQueryContext
Added by Anonymous about 20 years ago
Legacy ID: #2821964 Legacy Poster: Raffaele Sena (raff)
Why are the methods declareActiveNamespace() and declarePassiveNamespace() in StaticQueryContext "protected" while all the other namespace related methods are public ? Just curious :) I was playing with XOM and their new "streaming transformation" APIs, that are based on Saxon's XQuery processor. It's not really a big deal, and I understand that I should add the namespace declarations, but if you look at the example at http://dsd.lbl.gov/nux/api/nux/xom/xquery/StreamingPathFilter.html you'll see that what this does is to use XPath to "fetch" subnodes of the original document and then run the XQuery against the subnode. The StreamingPathFilter (that runs the XPath query) gets the namespaces as input parameters, while for the XQuery I would have to "prepend" them to the query. Again, it's not a big deal and sorry if I am talking about a lot of stuff not strictly Saxon related, but I was curios if there was any implementation reason to make those methods protected (and if you can suggest a better way to pass the namespaces around). Thanks, Raffaele Sena
Replies (2)
RE: Question about StaticQueryContext - Added by Anonymous about 20 years ago
Legacy ID: #2822045 Legacy Poster: Michael Kay (mhkay)
No particular logic to it really. I've never found a good way of deciding which methods should have which level of access - it's a mixture of whether I think they're safe / stable / useful / well-documented, and it doesn't tend to get reviewed after the code is written until someone hits the problem. Ideally APIs should be designed before implementations are written, based on use cases, but it often doesn't work that way. I'll change these to public. There may be constraints that prevent declaring passive namespaces after active namespaces have been declared - I'm not sure. Michael Kay
RE: Question about StaticQueryContext - Added by Anonymous about 20 years ago
Legacy ID: #2822201 Legacy Poster: Raffaele Sena (raff)
That's great! Thanks! And at least for my use the limitation you are pointing out should be fine. -- Raffaele
Please register to reply