Hi,
I am thinking of using BaseX in a project and have been impressed with it so far. So thanks to the developers and community.
I have run into the following problem. My XML coming from a client will be validated against XSD schema files. I would like to store the XSD documents in BaseX as well as the XML data. If I put the entire schema in one XSD file and add it to the database, all is fine and validate:xsd-info behaves as expected. However if I have two XSD files (a.xsd and b.xsd) and I include b.xsd in a.xsd with <xs:include.../>, validate:xsd-info returns an error:
7:40: src-resolve: Cannot resolve the name 'B' to a(n) 'type definition' component.
where type B is defined in the included file.
Is it possible to include a document stored in the database in this way?
If you want more detail about what I tried it is below.
Thanks!
Kevin.
What I tried:
1. start basexserver and launch basexgui (the commands below were executed in the gui)
2. create file a.xsd:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:include schemaLocation="b.xsd"/>
<xs:element name="root">
<xs:complexType>
<xs:choice>
<xs:element name="a" type="xs:string"/>
<xs:element name="b" type="B"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
3. create b.xsd:
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:complexType name="B">
<xs:sequence>
<xs:element name="c" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
4. create new database xsdtest in the gui
5. add the xsd files to the database:
db:add("xsdtest", "//home/.../a.xsd")
db:add("xsdtest", "//home/.../b.xsd")
6. run validation:
validate:xsd-info('<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="a.xsd"></root>', doc('/xsdtest/a.xsd'))
As mentioned above, I get the error:
7:40: src-resolve: Cannot resolve the name 'B' to a(n) 'type definition' component.
I tried with "schemaLocation" instead of "noNamespaceSchemaLocation"
I tried having a.xsd include "/xsdtest/b.xsd" as well as just "b.xsd" (xsdtest is the DB name)