BaseX Database Add in Java

前提是你 提交于 2019-12-12 03:04:25

问题


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);

The error I am getting is this:

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

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!


回答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



来源:https://stackoverflow.com/questions/9637909/basex-database-add-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!