xml - 模式有效性错误 : Element No matching global declaration available for the validation root

标签 xml validation xsd

我正在创建一个用于验证 XML 的 XSD,但它给了我以下验证错误:

$ xmllint --noout --schema imoveis.xsd imoveis.xml 
imoveis.xml:2: element alugueis: Schemas validity error : Element '{http://www.w3.org/2001/XMLSchema-instance}alugueis': No matching global declaration available for the validation root.
imoveis.xml fails to validate

不确定我忘记了什么。

这是我的XML:

<alugueis xmlns="http://www.w3.org/2001/XMLSchema-instance"
          noNamespaceSchemaLocation="imoveis.xsd"
          mes="outubro" ano="2012">

https://gist.github.com/paulodiovani/eb287e24de7be99a2263

这里是我的验证 XSD:

<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="simulado"
        xmlns:doc="simulado"
        elementFormDefault="qualified">

https://gist.github.com/paulodiovani/b00c682cdd4d8e1b8d7f

最佳答案

以这种方式修复您的 XML:

<alugueis xmlns="simulado"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="simulado imoveis.xsd"
          mes="outubro" ano="2012">

然后应该可以找到您的 XSD。您将需要进行进一步的修复(例如 condominio),但这些应该是不言自明的。如果没有,请随时再次发布。

关于xml - 模式有效性错误 : Element No matching global declaration available for the validation root,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23687993/

相关文章:

java - 如何在 Java 中创建具有多个模式的 XML 文档?

xml - 如何在 xsd :sequence 中至少指定一个

javascript - Jquery 验证以匹配电子邮件字段

java - android - 为什么我的 editText 不显示?

java - EditText 框在 Focus 事件上看起来不同

java - 以下 xml 的 jaxb 注释

c# - 验证纬度和经度

c# - 如何在 C# 中验证日期时间?

java - 在 JAR 中组织 XSD

xml - XPath中的逻辑或?为什么不加工?