Reputation: 1705
I started a project on github using maven-jaxb2-plugin to generate VMAP classes from the vmap xsd.
The problem I am running into appears to be an issue with the xsd itself.
[ERROR] Error while parsing schema(s).Location [ file:/projects/generate-vmap-example/src/main/resources/vmap.xsd{144,70}].
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'vast:VAST' to a(n) 'element declaration' component.
Everything seems to be setup correctly. vmap.xsd declares the vast namespace and imports the vast xsd.
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vmap="http://www.iab.net/videosuite/vmap" xmlns:vast="http://www.iab.net/videosuite/vast" targetNamespace="http://www.iab.net/videosuite/vmap" attributeFormDefault="unqualified" elementFormDefault="qualified" version="1.0">
<xs:import namespace="http://www.iab.net/videosuite/vast" schemaLocation="vast3_draft.xsd"/>
The VAST element is used here.
<xs:complexType name="VASTAdData_type">
<xs:sequence>
<xs:element ref="vast:VAST" minOccurs="1" maxOccurs="1"/>
</xs:sequence>
</xs:complexType>
Should the vmap xsd be modified for this to work? Why can't it find the VAST element?
You can view the full project here.
Upvotes: 0
Views: 75
Reputation: 927
In the vast3_draft.xsd file, if you add these attributs to the root xsd:schema
element:
So it becomes this:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified" xmlns="http://www.iab.net/videosuite/vast" targetNamespace="http://www.iab.net/videosuite/vast">
Then the vmap.xsd should properly parse when class generation occurs again.
The reason for this error is because in the vmap.xsd schema, it's importing vast3_draft.xsd using the targetNamespace
value of http://www.iab.net/videosuite/vast
and that namespace isn't anywhere in the vast3_draft.xsd schema. An xs:import
element always requires a targetNamespace
attribute, so the imported schema needs this as well.
I'm guessing because it has the word 'draft' in the file name, the schema itself might not be complete. If you get a new updated version of the schema you'll have to edit the schema file again if it still doesn't have the above attributes in the xs:schema
element.
Upvotes: 0