首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >2.4.c:匹配的通配符是严格的,但是不能为元素‘oai-标识符’找到声明。怎么解决这个问题?

2.4.c:匹配的通配符是严格的,但是不能为元素‘oai-标识符’找到声明。怎么解决这个问题?
EN

Stack Overflow用户
提问于 2019-07-30 10:23:58
回答 1查看 301关注 0票数 1

我有静态XSD模式,我想用它来验证来自OAI-PMH端点的XML响应。

据说这个模式已经被验证了。

然而,当我尝试验证来自随机OAI-PMH端点的XML响应时,比如这个端点:

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="static/style.xsl"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
    <responseDate>2019-07-29T13:29:04Z</responseDate>
    <request verb="Identify">https://repository.lib.ncsu.edu/oai/driver</request>
    <Identify>
        <repositoryName>NCSU Repository</repositoryName>
        <baseURL>https://repository.lib.ncsu.edu/oai/driver</baseURL>
        <protocolVersion>2.0</protocolVersion>
        <adminEmail>kdbeswic@ncsu.edu</adminEmail>
        <earliestDatestamp>2006-11-10T15:53:37Z</earliestDatestamp>
        <deletedRecord>transient</deletedRecord>
        <granularity>YYYY-MM-DDThh:mm:ssZ</granularity>
        <description>
            <oai-identifier xmlns="http://www.openarchives.org/OAI/2.0/oai-identifier"
                            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                            xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai-identifier http://www.openarchives.org/OAI/2.0/oai-identifier.xsd">
                <scheme>oai</scheme>
                <repositoryIdentifier>repository.lib.ncsu.edu</repositoryIdentifier>
                <delimiter>:</delimiter>
                <sampleIdentifier>oai:repository.lib.ncsu.edu:1840.20/1234</sampleIdentifier>
            </oai-identifier>
        </description>
    </Identify>
</OAI-PMH>

我明白这一例外:

代码语言:javascript
复制
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1055; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'oai-identifier'.
....

我不知道为什么会发生这种情况,相关的线索也没有帮助我。请帮帮我。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-07-30 12:36:52

虽然xsd:any基本上允许任何XML元素,但它的@processContents属性给出了严格性的变化。在这种情况下,@processContentsstrict,这意味着任何定义的元素都可能出现在那里。您的错误消息表明它无法找到oai-identifier元素的XSD定义。您可以通过执行以下操作之一来修复此问题:

  1. 更改XML以在该位置显示已定义的元素;
  2. 将XSD xsd:any/@processContents更改为laxskip
  3. 提供对oai-identifier定义的验证XML解析器访问。

也请参阅: 对于xsd:any,processContents严格的vs宽松的vs跳过的

注意:I能够成功地验证您发布的XML,而无需修改。我建议您再试一次,确保验证器能够访问每个所需的XSD(包括任何引用的XSD,临时的)。如果您有用于检索XSD的XML目录或其他重定向机制,请确保也检查这些机制。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57269516

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档