本文介绍了cvc-complex-type.2.4.c:匹配通配符严格,但找不到声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试理解 xsd 中的 元素.我有两个 xsd.

图书目录.xsd

Reviewer.xsd

但是如果我根据上面的 xsd 验证下面的 cvc-complex-type.2.4.c:匹配的通配符是严格的,但是找不到元素p:Reviewer"的声明. 错误.两个 xsd 文件不应该在同一个命名空间中吗?

解决方案

两个选项...

选项一:如果您不想必须有p:Reviewer的定义,请添加processContents=宽松" 到您的 xs:any 元素:

 

根据 >

processContents 属性的松散值指示

另请参见

您还应该仔细调整您的 xsi:schemaLocation 值,以指向正在播放的每个命名空间的每个 XSD 的实际文件名.这是您的

注意:确保 Review.xsd 中的 targetNamespace 与 BookCatalogue.xsi:schemaLocation 属性中为其声明的内容相匹配.

选项二:如果您确实想坚持p:Reviewer的定义存在,只需将上述更改为确保可以根据 xsi:schemaLocation 机制找到 Review.xsd.不需要 processContents 设置;它默认为 strict.

I am trying to understand <any> element in xsd. I had two xsds.

Book Catalogue.xsd

<?

Reviewer.xsd

<?

But if i validate the below cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'p:Reviewer'. error. Does both xsd file should not be in same namespace?

<?

Two options...

Option One: If you do not want to have to have the definition of p:Reviewer present, add processContents="lax" to your xs:any element:

      <xs:any namespace="##any" minOccurs="0"  processContents="lax"/>

Per

See also

You should also carefully adjust your xsi:schemaLocation values to point to the actual filename of each XSD for each namespace in play. Here is your

<?

Note: Make sure that the targetNamespace in Review.xsd matches what's declared for it in BookCatalogue.xsi:schemaLocation attribute.

Option Two: If you do want to insist that the definition of p:Reviewer be present, just make the above changes to be sure that Review.xsd can be found per the xsi:schemaLocation mechanism. No processContents setting is required; it defaults to strict.

这篇关于cvc-complex-type.2.4.c:匹配通配符严格,但找不到声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

查看更多