Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 715
paulodiovani Avatar asked Oct 20 '22 08:10

paulodiovani


1 Answers

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.

like image 188
kjhughes Avatar answered Oct 23 '22 04:10

kjhughes