XML 数据库 eXist 和语法验证
我又来了:/ 我设法使现有数据库以嵌入模式运行。但是,我无法实现隐式 XML 验证。 我按照此页面进行操作: http://exist.sourceforge.net/validation.html
这是我的conf.xml:
<validation mode="auto">
<entity-resolver>
<catalog uri="/db/catalog.xml" />
</entity-resolver>
</validation>
这是我插入到现有数据库中的catalog.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri name="http://www.w3.org/2001/XMLSchema" uri="videodes.xsd"/>
</catalog>
我也插入到数据库中的XML模式videodes.xsd看起来像这样:(
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
...
</xsd:schema>
我认为这个文件的全部内容并不重要,它也会提出这个问题长)
这是我的文件(videodes.xml),我将其插入数据库并希望对其进行验证:(
<?xml version="1.0" encoding="UTF-8"?>
<videodes xsi:noNamespaceSchemaLocation="videodes.xsd" xmlns=""
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</videodes>
我再次认为没有必要将全部内容放在这里)
不幸的是,验证不起作用并且我可以将无效数据插入到我的 videodes.xml 中。 我缺少什么?我猜我的catalog.xml 是问题所在,但我不知道应该在其中放入什么。我尝试了很多搜索,但没有任何用处。
我将不胜感激任何帮助,因为我真的需要完成这项工作。
提前致谢。
here I am again :/
I managed to make exist database run in embedded mode. However, what I can't make work is implicit XML validation.
I proceeded according to this page: http://exist.sourceforge.net/validation.html
This is my conf.xml:
<validation mode="auto">
<entity-resolver>
<catalog uri="/db/catalog.xml" />
</entity-resolver>
</validation>
This is my catalog.xml which I inserted into exist database:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<uri name="http://www.w3.org/2001/XMLSchema" uri="videodes.xsd"/>
</catalog>
My XML schema videodes.xsd which I also inserted into database looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
...
</xsd:schema>
(I think the entire content of this file isn't important, it would just make this question too long)
And this is my file (videodes.xml) which I inserted into the database and which I want to have validated:
<?xml version="1.0" encoding="UTF-8"?>
<videodes xsi:noNamespaceSchemaLocation="videodes.xsd" xmlns=""
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
</videodes>
(again I don't think it's necessary to put here the entire content)
Unfortunately, validation doesn't work and I can insert invalid data into my videodes.xml.
What Am I missing ? I guess my catalog.xml is the problem, but I don't know what I should put in it. I tried to search a lot but it wasn't any use.
I will appreciate any help because I really need to make this work.
Thank in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看我的对另一个问题的回答,这可能会有所帮助。简而言之,如果您的应用程序位于封闭的 Intranet 中,catalog.xml 文件中 DOCTYPE 声明的存在可能会产生问题,因为其系统标识符将无法解析。 DOCTYPE 声明不是必需的(除了验证文件),因此在生产时将其删除。
Check out my answer to a different question, which may be of some help. In brief, if your application lives in a closed intranet, the presence of the DOCTYPE declaration on your catalog.xml file might be the problem, as its system identifier won't be able to resolve. The DOCTYPE declaration is not necessary (except to validate the file) so remove it when in production.