XQJ with object input source


  • 2011-02-02

    Perhaps I'm missing something really obvious, or just don't completely
    understand XQJ. I've looked over the documentation, and nothing immediately
    jumps out at me for solving my problem. I have an object, say a
    org.w3c.dom.Node, or an InputStream, or a SAX Source. I can get it into pretty
    much any form needed, really. Is there a way to use Saxon HE's XQJ processor
    with that object? I understand the basics of XQJ: Create data source, create
    connection from data source, and then create and execute expressions. But I
    don't see any way to actually feed it input XML short of declaring a path to a
    document in the XQuery itself.

  • Michael Kay
    Michael Kay

    You need to use one of the methods such as bindDocument() in the
    XQDynamicContext interface. The class XQExpression implements this interface,
    so you can call bindDocument() before calling executeQuery().

    I'm no fan of XQJ, by the way. I designed s9api out of frustration with its
    weaknesses. Part of it is terminology - XQDataSource is not a data source,
    XQConnection is not a connection, XQExpression is not only an expression but
    also its dynamic context, XQSequence is not only a sequence but also a


  • 2011-02-02

    Thanks. Guess it was something obvious that I missed.