【问题标题】:Schemas validity error : Element No matching global declaration available for the validation root架构有效性错误:元素没有可用于验证根的匹配全局声明
【发布时间】:2014-05-15 20:27:39
【问题描述】:

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

$ 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 validation xsd


    【解决方案1】:

    以这种方式修复您的 XML:

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

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

    【讨论】:

      猜你喜欢
      • 2012-04-19
      • 2021-02-26
      • 2012-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-16
      相关资源
      最近更新 更多