架构有效性错误:元素没有可用于验证根的匹配全局声明

pau*_*ani 5 xml validation xsd

我正在创建一个 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
Run Code Online (Sandbox Code Playgroud)

不知道我忘记了什么。

这是我的XML:

<alugueis xmlns="http://www.w3.org/2001/XMLSchema-instance"
          noNamespaceSchemaLocation="imoveis.xsd"
          mes="outubro" ano="2012">
Run Code Online (Sandbox Code Playgroud)

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

在这里我验证XSD:

<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="simulado"
        xmlns:doc="simulado"
        elementFormDefault="qualified">
Run Code Online (Sandbox Code Playgroud)

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

kjh*_*hes 3

按以下方式修复您的 XML:

<alugueis xmlns="simulado"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="simulado imoveis.xsd"
          mes="outubro" ano="2012">
Run Code Online (Sandbox Code Playgroud)

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