Java中的BaseX数据库添加 [英] BaseX Database Add in Java

查看:182
本文介绍了Java中的BaseX数据库添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用BaseX api进行开发非常陌生,并且在使用其中一种方法时遇到了麻烦。我已经创建并打开了一个数据库,但是当我尝试使用Add方法时,它将引发异常。参见此页面作为BaseX的示例。

I am quite new to developing using the BaseX api, and I keep running into some trouble with one of the methods. I have a database created and opened, but when I try to use the Add method it throws an exception. See this page for an example from BaseX.

我在代码的另一部分中创建了数据库,并且我尝试添加的文件也存在于我的计算机上。我的代码段如下所示:

I have created the Database in another section of the code, and the file I am trying to add also exists on my computer. My snippet of code looks like this:

//Opens the database
new Open(databaseName).execute(context);

//adds file to database
new Add("", directoryPath + indexName + "/" + catalog.getInternalID() + ".Catalog.xml").execute(context);

我得到的错误是:

org.basex.core.BaseXException:〜/ cdsp.Catalog.xml(第1行):
应该有空格,找到了属性名称。

org.basex.core.BaseXException: "~/cdsp.Catalog.xml" (Line 1): whitespace expected, attribute name found.

我真的不知道这是什么意思,当我尝试将其他xml文件添加到数据库中时它们会起作用,并且我没有发现很多关于此异常的谷歌搜索。任何帮助将非常感激。谢谢!

I do not really know what this means, when I try to add other xml files to the database they work and I have not found much googleing this exception. Any help would be much appreciated. Thanks!

推荐答案

我不确定您是否仍在运行此问题。
无论如何,您的XML文件看起来都包含一个期望空格的属性。
您可以尝试在您选择的编辑器中打开cdsp.Catalog.xml并查看第1行的内容。

I am not sure if you are still running in this problem. Anyway it looks like your XML file contains an attribute where white space is expected. You could try opening cdsp.Catalog.xml in an editor of your choice and see what is there at line 1.

希望这会有所帮助,
迈克尔

Hope this helps, Michael

这篇关于Java中的BaseX数据库添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆