I try to define some xsd scheme for my xml files.
The xml structure is something like
<?xml version="1.0" encoding="UTF-8"?>
<product name="abc" xmlns="http://example.org/productMetadata.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.org/productMetadata.xsd productMetadata.xsd">
<metainf />
</product>
(root tag with some defined attribute "name" and some nested tags as in the example "metainf")
My approach in defining the xsd looks like
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://example.org/productMetadata.xsd" xmlns="http://example.org/productMetadata.xsd">
<xsd:element name="product">
<xsd:complexType>
<xsd:all>
<xsd:element type="xsd:string" name="metainf" />
</xsd:all>
<xsd:attribute type="xsd:string" name="name" />
</xsd:complexType>
</xsd:element>
</xsd:schema>
Nevertheless, I'm not able to validate the xml against the xsd.
Depending on the validator (I used java, a web-app and eclipse) I get the following failure message.
Invalid content was found starting with element 'metainf'. One of '{metainf}' is expected.
or
Cvc-complex-type.2.4.a: Invalid Content Was Found Starting With Element 'metainf'. One Of '{metainf}' Is Expected., Line '5', Column '13'.
Anyone some hint, what's wrong with my xsd or xml.