From: Frederic Laurent (fl@opikanoba.org)
Date: 18/03/2004 - 08:59
Fabrice Estiévenart wrote:
> bonjour,
>
> quelle est la manière la plus simple d'interroger un fichier xml avec
> xquery en Java ? est-ce que la librairie xalan permet de le faire ?
xalan, non
saxon oui : http://saxon.sourceforge.net/saxon7.9/using-xquery.html
il y a aussi
Qexo : http://xmlfr.org/actualites/breves/2004-02-16#T15:08:17:189
XQEngine : http://xmlfr.org/actualites/breves/2003-12-05#T09:02:55:121
voici un exemple en Jython (java avec la syntaxe python), de
l'utilisation de saxon
from java.io import *
from javax.xml.transform.sax import *
from org.xml.sax import *
from net.sf.saxon.query import *
from net.sf.saxon import *
expr="for $i in (10, 20), $j in (1, 2) return ($i + $j)"
config = Configuration(hostLanguage = Configuration.XQUERY)
xquery = QueryProcessor(config, StaticQueryContext())
exp = xquery.compileQuery(StringReader(expr))
it = exp.iterator(DynamicQueryContext())
while (it.hasNext()):
print it.next()
HTH
cordialement
--
Frédéric Laurent
http://www.opikanoba.org
--
Devenez redacteur <XML>fr et contribuez au developpement du
xml francophone (http://xmlfr.org/infos/redacteurs/) !
Liste de diffusion "xml-tech@xmlfr.org" (http://xmlfr.org).
Cette liste est a votre disposition pour discuter en francais de
tout sujet technique lie a XML.
Pour resilier votre abonnement, envoyez un message contenant
la commande "unsubscribe" a xml-tech-request@xmlfr.org
(mailto:xml-tech-request@xmlfr.org?Subject=unsubscribe)
Archive générée par hypermail 2.1.3 le 28/06/2004 - 11:05 UTC
webmaster@xmlfr.org
|