我正在创建一个用于验证 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">
最佳答案
以这种方式修复您的 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/