|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] xpath/xquery to eleminate certain nodesMichael Kay mike at saxonica.comTue Aug 26 18:14:24 PDT 2008
Saxon-SA needs to be downloaded from www.saxonica.com and activated with a license key (free for 30 days). My log file doesn't show any recent request in your name for a license key. Having installed Saxon-SA and a license key, you need to invoke the query engine in updating mode. If you're doing that from the command line, set -update:on. If you're doing it using s9api, call setUpdatingEnabled(true) on the XQueryCompiler. I'm afraid I've no idea whether this can be done via XMLBeans. The documentation at http://xmlbeans.apache.org/documentation/conInstallGuide.html mentions some very old Saxon releases indeed. Michael Kay Saxonica > -----Original Message----- > From: http://x-query.com/mailman/listinfo/talk > [mailto:http://x-query.com/mailman/listinfo/talk] On Behalf Of Christian Schlaefcke > Sent: 26 August 2008 16:19 > To: http://x-query.com/mailman/listinfo/talk > Subject: RE: xpath/xquery to eleminate certain nodes > > Hi Micheal, > > I just downloaded saxon9 (9.1.0.1) and put it in my local > Maven2 repository and added it to my classpath with these > dependencies: > <dependency> > <groupId>net.sf.saxon</groupId> > <artifactId>saxon9sa</artifactId> > <version>9.1.0.1</version> > </dependency> > <dependency> > <groupId>net.sf.saxon</groupId> > <artifactId>saxon9sa-jaxp</artifactId> > <version>9.1.0.1</version> > </dependency> > <dependency> > <groupId>net.sf.saxon</groupId> > <artifactId>saxon9sa-qc</artifactId> > <version>9.1.0.1</version> > </dependency> > <dependency> > <groupId>net.sf.saxon</groupId> > <artifactId>saxon-dom</artifactId> > <version>9.1.0.1</version> > </dependency> > > Having this I do not get the "no query engine" error, so I > guess it XmlBeans can access Saxonias query engine. > > But I still get the "XPST0003" error. Maybe "updating" is not > enabled by default - how can it be "enabled" then? > > Thanks & Regards, > > Christian > > > To run XQuery Update in Saxon you need the Saxon-SA version of the > > product, and you need to run it with updating enabled. > > > > Michael Kay > > http://www.saxonica.com/ > > > >> -----Original Message----- > >> From: http://x-query.com/mailman/listinfo/talk > >> [mailto:http://x-query.com/mailman/listinfo/talk] On Behalf Of Christian Schlaefcke > >> Sent: 26 August 2008 15:13 > >> To: http://x-query.com/mailman/listinfo/talk > >> Subject: Re: xpath/xquery to eleminate certain nodes > >> > >> Thank you John! > >> > >> looks promising! But after I tried to adapt it to my application I > >> have some trouble with XmlBeans and Saxon that I use to run my > >> queries. > >> > >> After I found out that xquery uptate was not available with the > >> XmlBeans/Saxon versions I used (2.3.0/8.7) I upgraded to versions > >> (2.4.0/9.1.0.1) and now I get this error: > >> > >> Error on line 3 column 9 > >> XPST0003: XQuery syntax error in #...$this external; copy $#: > >> Unexpected token "copy" in path expression > >> > >> My query looks like this: > >> declare namespace mns='http://www.mynamespace.com'; > >> copy $a := / > >> modify delete node > >> $a/mns:sites/mns:site//mns:categories/mns:category[@id = "888"] > >> return $a > >> > >> Did someone encounter this problem before? > >> > >> Thanks & Regards, > >> > >> Christian > >> > >> > >> > Hi Christian, > >> > > >> > XQuery Update can be used to solve your problem fairly easily - > >> > something like this should do the trick: > >> > > >> > copy $a := / > >> > modify delete nodes $a/site/sites//categories/category[@name = > >> > 'hidden'] return $a > >> > > >> > John > >> > > >> > Christian Schlaefcke wrote: > >> >> Hi, > >> >> > >> >> I am fighting with a xpath/xquery expression to select the > >> whole xml > >> >> document except of certain nodes that I want to remove. > >> The general > >> >> structure of the document should be preserved. > >> >> > >> >> With my approaches I either select too much or too less and my > >> >> research @ google & co. did not bring me any further :-( > >> >> > >> >> The document structure is a bit tricky (arbitrarily nested > >> >> categories) - imagine the following document: > >> >> <sites> > >> >> <site> > >> >> <categories> > >> >> <category name="root"> > >> >> <categories> > >> >> <category name="category_1"> > >> >> <some> > >> >> <further> > >> >> <nested> > >> >> <info info_id="1">Important Information</info> > >> >> </nested> > >> >> </further> > >> >> </some> > >> >> </category> > >> >> <category name="category_2"> > >> >> <some> > >> >> <further> > >> >> <nested> > >> >> <info info_id="2">Less Important > >> Information</info> > >> >> </nested> > >> >> </further> > >> >> </some> > >> >> </category> > >> >> </categories> > >> >> </category> > >> >> <category name="hidden"> > >> >> <categories> > >> >> <category name="dont_need_it"> > >> >> <some> > >> >> <further> > >> >> <nested> > >> >> <info info_id="3">Unimportant > Information</info> > >> >> </nested> > >> >> </further> > >> >> </some> > >> >> </category> > >> >> <category name="dont_need_it_too"> > >> >> <some> > >> >> <further> > >> >> <nested> > >> >> <info info_id="4">Even More Unimportant > >> >> Information</info> > >> >> </nested> > >> >> </further> > >> >> </some> > >> >> </category> > >> >> </categories> > >> >> </category> > >> >> </categories> > >> >> </site> > >> >> </sites> > >> >> > >> >> What I want would be: > >> >> <sites> > >> >> <site> > >> >> <categories> > >> >> <category name="root"> > >> >> <categories> > >> >> <category name="category_1"> > >> >> <some> > >> >> <further> > >> >> <nested> > >> >> <info info_id="1">Important Information</info> > >> >> </nested> > >> >> </further> > >> >> </some> > >> >> </category> > >> >> </categories> > >> >> </category> > >> >> </categories> > >> >> </site> > >> >> </sites> > >> >> > >> >> I tried several approaches like: > >> >> /site/sites//categories/category[@name = 'category_1'] or > >> >> /site/sites//categories/category[@name != 'hidden'] or > >> >> > >> > /site/sites//categories/category/some/further/nested/info[@info_id = > >> >> '1'] > >> >> > >> >> But all I get is something like this: > >> >> <category name="category_1"> > >> >> <some> > >> >> <further> > >> >> <nested> > >> >> <info info_id="1">Important Information</info> > >> >> </nested> > >> >> </further> > >> >> </some> > >> >> </category> > >> >> > >> >> What is missing to preserve the parent xml data? > >> >> > >> >> Any hint that will point me to the right direction > would be very > >> >> appreciated! > >> >> > >> >> Thank & Regards, > >> >> > >> >> Christian > >> >> > >> >> > >> >> > >> >> _______________________________________________ > >> >> http://x-query.com/mailman/listinfo/talk > >> >> http://x-query.com/mailman/listinfo/talk > >> > > >> > > >> > -- > >> > John Snelson, Oracle Corporation > >> http://snelson.org.uk/john > >> > Berkeley DB XML: > >> http://oracle.com/database/berkeley-db/xml > >> > XQilla: > >> http://xqilla.sourceforge.net > >> > _______________________________________________ > >> > http://x-query.com/mailman/listinfo/talk > >> > http://x-query.com/mailman/listinfo/talk > >> > >> > >> > >> > >> _______________________________________________ > >> http://x-query.com/mailman/listinfo/talk > >> http://x-query.com/mailman/listinfo/talk > > > > > _______________________________________________ > http://x-query.com/mailman/listinfo/talk > http://x-query.com/mailman/listinfo/talk
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






