473,385 Members | 1,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Schema import statements

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
Jul 20 '05 #1
1 4145
import namespace can't be same as targetNamespace of schema it exists in.

http://www.w3schools.com/schema/el_import.asp

http://www.w3schools.com/schema/el_include.asp
mi***@privat.dk (Dennis B. Hansen) wrote in message news:<3f*****************@news.tele.dk>...
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

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Olaf Meyer | last post by:
Apprentently xerces 2.6.0 (Java) does not validate against contraints specified in the schema (e.g. constraints specified via unique element). The validation works with the XML editor I'm using...
0
by: Andy Dingley | last post by:
I'm writing XSLT to transform fntg-schema (our own project's document schema) into PartnerML, a HTML-like XML dialect used for mobile phones. I'm using XMLSPy 4.4 to do this. The schema for...
4
by: Gordon Dickens | last post by:
I have target xml to generate from schema. All of the XML instances have the same global element i.e. <base>. I would like to combine all of the schemas into a single schema where I could...
4
by: Iain Robinson | last post by:
Hi all, I'm pretty new to schemas and i've been using Oxygen XML editor to generate and associate XSD files from my own XML files. The results are pretty simple but there is one aspect thats...
2
by: Stanimir Stamenkov | last post by:
I'm trying to find out if it is permissible to include a schema document with absent target namespace to a schema with specified target namespace, and if it is, what are the rules to resolve the...
4
by: Iain A. Mcleod | last post by:
Hi I'm stuck with the following schema validation problem in VS.NET 2003: I have two types of xml document and related schema: project and projectCollection. A projectcollection is just a set...
1
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i...
5
by: Jeff | last post by:
We are using .Net and the wsdl Utility to generate proxies to consume web services built using the BEA toolset. The data architects on the BEA side create XML schemas with various entities in...
1
by: bhaumik | last post by:
I am trying to validate an XML document using MSXML against a schema that contains 4 import statements to additional .xsd files. The code is written in C/C++. MSXML seems to work ok if I use a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.