模式有效性错误:验证根没有匹配的全局声明



我正在创建一个用于验证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),但这些应该是不言自明的。

最新更新