Reputation: 636
I have three XSDs: deviceprofile.xsd, relatedType.xsd and profilelist.xsd
deviceprofile.xsd is the root XSD which refers to relatedtype.xsd, which in turn refers to profilelist.xsd.
The reference between relatedtype.xsd and profilelist.xsd works fine, but the relation between deviceprofile.xsd and relatedType.xsd is giving problems.
I have imported the XSDs with the relevant namespaces, but when parsing deviceprofile.xsd with JAXB, its giving:
[ERROR] src-resolve: Cannot resolve the name 'relatedData' to a(n) 'element decl
aration' component.
line 47 of file:/D:/Personal/Java/Trials/src/com/asl/trials/cea/xml/deviceprof
ile.xsd
Failed to parse a schema.
The XSDs are all in the same directory, so I can be sure that its not a path problem.
Can someone please point out as to what I am doing wrong???
I have attached relevant snippets of the XSDs below (just in case):
deviceprofile.xsd
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="urn:schemas-upnp-org:remoteui:uilist-1-0" targetNamespace="urn:schemas-upnp-org:remoteui:uilist-1-0" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" id="uilist">
<xs:import namespace="urn:schemas-ce-org:ce-html-server-caps-1-0" schemaLocation="relatedtype.xsd" />
<xs:element name="uilist">
<xs:complexType>
<xs:sequence>
<xs:element ref="relatedData" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
relatedtype.xsd
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema xmlns="urn:schemas-ce-org:ce-html-server-caps-1-0"
xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:schemas-ce-org:ce-html-server-caps-1-0"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:include schemaLocation="profilelist.xsd" />
<xs:element name="relatedData" type="relatedType" />
<xs:complexType name="relatedType">
<xs:sequence>
<xs:element name="keyword" type="xs:string" minOccurs="0"
maxOccurs="unbounded" />
<xs:element ref="profilelist" minOccurs="1" maxOccurs="unbounded" />
<xs:element name="saveStateStorageURL" type="xs:anyURI"
minOccurs="0" maxOccurs="1" />
<xs:element name="savedStatesInfo" type="savedStatesInfoType"
minOccurs="0" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="savedStatesInfoType">
<xs:attribute name="saveTime" type="xs:string" />
<xs:attribute name="forUser" type="xs:string" use="optional" />
</xs:complexType>
</xs:schema>
profilelist.xsd
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="profilelist" type="profileListType" />
<xs:complexType name="profileListType">
</xs:complexType>
...
</xs:schema>
Upvotes: 1
Views: 2198
Reputation: 149057
In deviceprofile.xsd
schema you will need to declare the urn:schemas-ce-org:ce-html-server-caps-1-0
namespace, and then include the corresponding prefix in the ref
value. Below I've used the foo
prefix:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="urn:schemas-upnp-org:remoteui:uilist-1-0"
targetNamespace="urn:schemas-upnp-org:remoteui:uilist-1-0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:foo="urn:schemas-ce-org:ce-html-server-caps-1-0"
elementFormDefault="qualified"
attributeFormDefault="unqualified" id="uilist">
<xs:import namespace="urn:schemas-ce-org:ce-html-server-caps-1-0"
schemaLocation="relatedtype.xsd" />
<xs:element name="uilist">
<xs:complexType>
<xs:sequence>
<xs:element ref="foo:relatedData" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Upvotes: 1