Schemas validity error : Element No matching global declaration available for the validation root

StackOverflow https://stackoverflow.com/questions/23687993

  •  23-07-2023
  •  | 
  •  

Pergunta

I'm creating an XSD for validating a XML, but it gives me the following validation error:

$ 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

Not sure what I'm forgetting.

Here is my XML:

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

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

And here my validating XSD:

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

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

Foi útil?

Solução

Fix your XML in this way:

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

And your XSD should then be able to be found. You will have further fixes to make (eg condominio), but those should be self-explanatory. If not, feel free to post again.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top