XPath over sets of files

Hi, I know about the Find/Replace in Files option on the context menu in the Project View. Run a string (or regular expression) search through a set of files collected in a folder in your project. Cool. How about an XPath option that would work the same way? Currently I usually write myself a little Schematron to locate particular nodes, which isn't a big deal. But it would be nice not to have to when the search can be expressed simply in a one-line XPath. Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@mulberrytech.com Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Wendell Piez wrote: Hi Wendell,
How about an XPath option that would work the same way? Currently I usually write myself a little Schematron to locate particular nodes, which isn't a big deal. But it would be nice not to have to when the search can be expressed simply in a one-line XPath.
Sounds like a great idea! If I can give my $0.02, I think it could even be generalized by providing an XQuery sandbox along with a few variables, functions or collections: collection('prj:my-project?pattern=*.xsd') // xs:complexType/@name/data(.) collection('file:///home/me/xslt?pattern=*.xsd') // xsl:template/@name[resolve-QName(., ..)[ namespace-uri-from-QName(.) eq 'http://my.ns' ]] / document-uri(.) Augmented with a dialog box to set up the default collection by using a directory selection dialog box, project dropdown list and various options, as well as a saved history, I think that would be a powerful general purpose tool (while well integrated into oXygen yet.) Hope that helps. Regards, --drkm

Florent Georges wrote:
Augmented with a dialog box to set up the default collection by using a directory selection dialog box, project dropdown list and various options, as well as a saved history, I think that would be a powerful general purpose tool (while well integrated into oXygen yet.)
And of course it could run in a 'find' mode where oXygen would open the document of each matched node in the editor, jumping directly to that node, one after the other while clicking 'next'. --drkm

Dear Florent, At 05:08 PM 9/26/2008, you wrote:
How about an XPath option that would work the same way? Currently I usually write myself a little Schematron to locate particular nodes, which isn't a big deal. But it would be nice not to have to when the search can be expressed simply in a one-line XPath.
Sounds like a great idea! If I can give my $0.02, I think it could even be generalized by providing an XQuery sandbox along with a few variables, functions or collections:
collection('prj:my-project?pattern=*.xsd') // xs:complexType/@name/data(.)
collection('file:///home/me/xslt?pattern=*.xsd') // xsl:template/@name[resolve-QName(., ..)[ namespace-uri-from-QName(.) eq 'http://my.ns' ]] / document-uri(.)
Augmented with a dialog box to set up the default collection by using a directory selection dialog box, project dropdown list and various options, as well as a saved history, I think that would be a powerful general purpose tool (while well integrated into oXygen yet.)
It would, and yes, I thought of something like this too, although it might not have been as fully worked out in my mind. :-) But I decided to ask just for XPath -- if only because that would make for a simple, one-line interface available from the context menu in the Project View. Not that the two features are incompatible, of course. Cheers, Wendell ====================================================================== Wendell Piez mailto:wapiez@mulberrytech.com Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================

Hi, Executing XPath over a set of files it is already possible using the Saxon 9 collection function. For example collection('.?select=*.xsd;on-error=ignore')/* will return the root elements from all the *.xsd files from the directory holding the current file and will ignore errors if some *.xsd file is not wellformed XML. Along with the XPath search field in the toolbar oXygen provides also an XPath Builder View that gives a better layout for writing these XPath queries and also holds a history with the last executed XPath queries. oXygen allows also to set a CollectionURIResolver for Saxon (in Options->Preferences -- XML / XSLT-FO-XQuery / XSLT / Saxon / Saxon-B/SA / Advanced) so basically one can implement support for special collections as the results returned by the collection function. Checking this - it works only for XSLT and XQuery execution but not for XPath 2.0. Adding in oXygen support for some default collections as Florent suggested looks like a nice idea and we recorded it on our issues tracking system. For more information about using the Saxon collection function see http://www.saxonica.com/documentation/sourcedocs/collections.html Best Regards, George -- George Cristian Bina <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com Wendell Piez wrote:
Hi,
I know about the Find/Replace in Files option on the context menu in the Project View. Run a string (or regular expression) search through a set of files collected in a folder in your project. Cool.
How about an XPath option that would work the same way? Currently I usually write myself a little Schematron to locate particular nodes, which isn't a big deal. But it would be nice not to have to when the search can be expressed simply in a one-line XPath.
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@mulberrytech.com Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
_______________________________________________ oXygen-user mailing list oXygen-user@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-user

Hi George, At 08:59 AM 10/1/2008, you wrote:
Executing XPath over a set of files it is already possible using the Saxon 9 collection function. For example
collection('.?select=*.xsd;on-error=ignore')/*
will return the root elements from all the *.xsd files from the directory holding the current file and will ignore errors if some *.xsd file is not wellformed XML.
Yes, I have used this on occasion. As I have used Schematron for similar purposes (as a querying application not a means of validation). What I'm looking for now is an option that would allow me, with very minimal overhead (i.e., no Schematron or XQuery file creation, no Scenario setup) run an XPath over an arbitrary set of files defined as a folder in a project, in a very ad-hoc way. Many if not most of my projects already end up with utility XQuery and/or Schematron files for this purpose. But something more accessible from the menus would also be easier for beginners to find and use. Even duplicating functionalities found elsewhere, IMHO, anything that makes it easier for beginners (including editorial staff who are nervous about XQuery but who know more XPath than they pretend) is in principle a good thing, especially when it sets up a learning feedback loop (with XPath in this case). And I bet people (even we experts) would use this feature. :-)
Adding in oXygen support for some default collections as Florent suggested looks like a nice idea and we recorded it on our issues tracking system.
Once this is in place, I bet implementing a widget such as I've described would be a proverbial piece of cake. Thanks again, Wendell ====================================================================== Wendell Piez mailto:wapiez@mulberrytech.com Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
participants (4)
-
Florent Georges
-
George Cristian Bina
-
Syd Bauman
-
Wendell Piez