D
Dennis B. Hansen
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="testositiveNumber"
minOccurs="0"/>
</sequence>
</complexType>
</schema>
.... Thanx in advance
/Dennis
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="testositiveNumber"
minOccurs="0"/>
</sequence>
</complexType>
</schema>
.... Thanx in advance
/Dennis