如何解决XSD错误“通配符导致内容模型变得模棱两可”

时间:2018-11-08 17:00:14

标签: c# xml compilation xsd

我有一个XSD架构文件,该文件引发以下编译错误:

$ python urljpeg.py
5120 5120
5120 10240
4240 14480
5120 19600
...
5120 214000
3200 217200
5120 222320
5120 227440
3167 230607
Header length 393
HTTP/1.1 200 OK
Date: Wed, 11 Apr 2018 18:54:09 GMT
Server: Apache/2.4.7 (Ubuntu)
Last-Modified: Mon, 15 May 2017 12:27:40 GMT
ETag: "38342-54f8f2e5b6277"
Accept-Ranges: bytes
Content-Length: 230210
Vary: Accept-Encoding
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Connection: close
Content-Type: image/jpeg

这是XSD及其编译代码:

System.Xml.Schema.XmlSchemaException: 'Wildcard '##targetNamespace' allows
element 'http://mycompany.com/datamodel/tasks:OwnerID', and causes the 
content model to become ambiguous. A content model must be formed such that 
during validation of an element information item sequence, the particle 
contained directly, indirectly or implicitly therein with which to attempt 
to validate each item in the sequence in turn can be uniquely determined 
without examining the content or attributes of that item, and without any 
information about the items in the remainder of the sequence.'

是否有一种方法可以更改XSD文档以避免该错误,但保留模式的原始含义?我看到过类似的问题,如果我理解正确,解析器将不知道是否应针对“任何”规则或明确指定的元素验证遇到的元素。我认为XSD 1.1不会发生这种错误,但.NET似乎不支持较新的版本。有什么说明可以解决吗?

0 个答案:

没有答案