[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message]

Tool development: by Perl-wrapped XQuery

Martin Probst mail at martin-probst.com
Fri Sep 4 15:12:03 PDT 2009


  Tool development: by Perl-wrapped XQuery
> If you can find one vendor/ implementation that has all the pices its a tad
> easier (document types match !) but its still a bit of hell.

That is where I'd say at least in Java land, you can get everything to
accept SAX or DOM. It might not be the absolute best choice (e.g.
Saxon and its TinyTree), but it will work.

I actually can't come up with a tool I needed to use in Java that
didn't support DOM. Can you?

> I think you'll find it about as painful to to use jruby or jython to say
> call  xinclude , then rng validate then xquery then pass its results to xslt
> as writing it in pure java.

Indeed, the problem is that these APIs are extremely verbose and have
an erratic programming model. Parsing a document in Java is a 20 line+
endeavor, and if you want to get it right you'll have to set magic
parser features using undocumented strings no one knows where to find.

But this is the kind of thing you can do right if you don't need the
flexibility to supply your own DocumentBuilderFactory (or whatever),
just by mandating a default.

> In xmlsh its as simple as   xinclude file | rngvalidate schema | xquery -f
> schema | xslt -f stylesheet
>
> To get these kind of languages (jruby etc) into shape where XML is actually
> *easy to use* is going to require work.  Possibly at the language level to
> make it really easy.

Yes, but only a reasonable amount of work. The above code would
actually be valid JRuby syntax, so you wouldn't need any language
extensions, just some library routines.

> I talked to a Ruby programmer at work after a demonstration on XQuery and
> his answer was "I can do that in ruby ... why would I want to learn xquery ?
>  And ruby can do a LOT more then just xml processing " ... After seeing some
> of his code I had to admit he had a point.  I still have been unable to
> successfully convince him the value of xquery over Ruby's XML API's.

Ruby has this nice feature of being very amenable to domain specific
languages, and some of the XML APIs use this nicely. However the
built-in XML support in Ruby is plain horrible, REXML is a huge can of
bugs.

And of course with imperative code in Ruby you loose all the
declarative/optimizable/... niceness of XQuery and XSLT.

Martin



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2011 All Rights Reserved.