Dear David, thanks for your e-mail and your report. I finally had some time to look at your example, and I managed to reproduce the problem. As the error is raised before BaseX gets into action, I'm passing this on to Charles Foster who wrote the wonderful XQJ implementation for BaseX.. @Charles: this is the Saxon class that raises the error.. https://dev.saxonica.com/repos/archive/opensource/latest9.2/hej/net/sf/saxon... ..and this is the specification link to the SEPM0009 code: http://www.w3.org/TR/xslt-xquery-serialization-30/#ERRSEPM0009 Do you have an idea if this issue can be solved within your API? Thanks, Christian ---------- Forwarded message ---------- From: David Oguns <davidoguns@gmail.com> Date: Thu, Sep 27, 2012 at 5:05 PM Subject: [basex-talk] XQJ: Exception using Saxon9 TransformerFactoryImpl To: basex-talk@mailman.uni-konstanz.de I am trying to perform a basic document insert using the XQJ API communicating with a standalone BaseXServer. I have a lot of dependencies on my classpath (I'm sure this affects JAXP's behavior), including Saxon, Xerces, Xalan, and probably a few versions of some of them. When I set the transformer factor explicitly to Xalan, there is no exception, but otherwise it appears Saxon is being used and it down throw an exception. I have a very high opinion of Saxon so I have my doubts that it's doing anything illegal with respect to the standards, so I thought I should ask what is going on. This is the property I can set to get rid of the problem: System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.processor.TransformerFactoryImpl"); Here is the exception and stack trace: javax.xml.xquery.XQException: XQJTO013 - Values of 'standalone' and 'omit-xml-declaration' conflict Root Cause: net.sf.saxon.trans.XPathException: Values of 'standalone' and 'omit-xml-declaration' conflict at MyClass.main(MyClass.java:82) at net.sf.saxon.serialize.XMLEmitter.writeDeclaration(XMLEmitter.java:226) at net.sf.saxon.serialize.XMLEmitter.openDocument(XMLEmitter.java:143) at net.sf.saxon.serialize.XMLEmitter.startElement(XMLEmitter.java:303) at net.sf.saxon.event.NamespaceReducer.startElement(NamespaceReducer.java:72) at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:290) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:400) at net.sf.saxon.event.Sender.send(Sender.java:154) at net.sf.saxon.IdentityTransformer.transform(IdentityTransformer.java:35) at MyClass.main(MyClass.java:82) And here is the relevant code: XQDataSource xqs = new BaseXXQDataSource(); xqs.setProperty("serverName", "localhost"); xqs.setProperty("port", "1984"); XQConnection conn = xqs.getConnection("admin", "admin"); try { XQStaticContext context = conn.getStaticContext(); XMLStreamReader xmlReader = XMLInputFactory.newInstance().createXMLStreamReader(new FileReader(args[0])); XQPreparedExpression xqpe = conn.prepareExpression("declare namespace output = \"http://www.w3.org/2010/xslt-xquery-serialization\";declare option output:omit-xml-declaration \"no\";declare variable $doc external;\nfn:put($doc,\"jc003.xml\")", context); //xquery doc('oguns/jc001.xml') try{ xqpe.bindDocument(new QName("doc"), xmlReader, conn.createDocumentType()); XQResultSequence xqrs = xqpe.executeQuery(); } finally { xqpe.close(); } } finally { conn.close(); } _______________________________________________ BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk