Sorry for the repeat posts on my last question. I was expecting a confirmation from the web page that the mail was sent - I should know better than to keep clicking :)
As stated in my previous question (subject: Issues with XQuery insert), we have tried different methods to add new XML documents to a collection using the Java API. One such approach is to use the Add command, supplying the document content as the XML string.
When doing so, the process will fail when there are double quotes used in the attribute values. For example, the following string;
<s:test xmlns:s="abc" xmlns:x="def">hello</s:test>
yields this error;
(Line 1): Open quote is expected for attribute "{1}" associated with an element type "xmlns:s".
Alternatively this string;
<s:test xmlns:s='abc' xmlns:x='def'>hello</s:test>
is not an issue.
The double quotes are also not an issue when the argument to the Add command points to a file. Has anyone else encountered this issue? We could of course replace the double quotes with single quotes - however this is not desirable since some of the content of our XML file may contain double quotes that we would not want to change.
Thanks,
J Gager
Hi again,
sorry for the late reply. As indicated, the best way to insert new documents into a database is the ADD command. As you have noticed, no double quotes are allowed on command line, if you call ADD. This should work, however, if you create and call an instance of the Add class, as shown in this example..
http://basex.org/code.php?code=CollectionExample
Initially, the Add command was designed to process files. You might have a closer look into the Add class to see what's going on internally:
https://svn.uni-konstanz.de/dbis/basex/trunk/basex/src/main/java/org/basex/c...
Feel free to ask for more, Christian
On Wed, Jan 27, 2010 at 10:21 PM, J Gager j.gager@metadatatechnology.com wrote:
Sorry for the repeat posts on my last question. I was expecting a confirmation from the web page that the mail was sent - I should know better than to keep clicking :)
As stated in my previous question (subject: Issues with XQuery insert), we have tried different methods to add new XML documents to a collection using the Java API. One such approach is to use the Add command, supplying the document content as the XML string.
When doing so, the process will fail when there are double quotes used in the attribute values. For example, the following string;
<s:test xmlns:s="abc" xmlns:x="def">hello</s:test>
yields this error;
(Line 1): Open quote is expected for attribute "{1}" associated with an element type "xmlns:s".
Alternatively this string;
<s:test xmlns:s='abc' xmlns:x='def'>hello</s:test>
is not an issue.
The double quotes are also not an issue when the argument to the Add command points to a file. Has anyone else encountered this issue? We could of course replace the double quotes with single quotes - however this is not desirable since some of the content of our XML file may contain double quotes that we would not want to change.
Thanks,
J Gager
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de