Schema import statements

Dennis B. Hansen

Usenet Archive
Joined
Aug 4, 2003
Messages
1
Reaction score
0
Hi all...

I'm having some problems JAXB compiling som schemas, and was wondering if what i was trying to do is simply wrong... the problem seems to be with my import statements, and I've tried to create a simple example that generates the error (included below).

I have two imported schemas, and JAXB seems to only want to import one of them (possibly because they have same namespace (???)).

My questions are:
1) Have I misunderstood imports, and is it illegal to import two schemaes with the same namespace (XMLSpy does'nt seem to see that as a problem).
2) Could it be done in another way?
3) Anyone have experience with other XML -> Java generators?

A simple eksempel ;-)... :

<?xml version="1.0"?>
<schema targetNamespace="Tester"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<simpleType name="NonEmptyString">
<restriction base="string">
<minLength value="1"/>
</restriction>
</simpleType>
</schema>

<?xml version="1.0"?>
<schema targetNamespace="Tester"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<simpleType name="PositiveNumber">
<restriction base="integer">
<minInclusive value="0"/>
</restriction>
</simpleType>
</schema>

<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="Foo"
xmlns:test="Tester"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> <import namespace="Tester" schemaLocation="SimpleNumber.xsd"/> <import namespace="Tester" schemaLocation="SimpleString.xsd"/> <complexType name="StringNumber"> <sequence> <element name="aString" type="test:NonEmptyString" minOccurs="0"/> <element name="aNumber" type="test:positiveNumber" minOccurs="0"/> </sequence> </complexType> </schema>

.... Thanx in advance

/Dennis
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,208
Messages
3,104,798
Members
249,594
Latest member
henrywalsh

Latest Threads

Top