This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Web Services and the fly likes xml schema question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Web Services
Bookmark "xml schema question" Watch "xml schema question" New topic

xml schema question

Adam Al

Joined: Oct 09, 2012
Posts: 1
I am running into this problem with xml schema, here is my issue
I have 3 schema(s), each with different name space. One schema "A" has 2 elements, one is header and the other is "Data".
Data can be any of 2 schema(s) (one or the other) , since these schema(s) do not have the same name space , I used import, but still having problem
Here are sample of I am trying to do , any help will be appreciate it. (I need this to be able use jaxb)
<?xml version="1.0" ?>
<xs:schema targetNamespace=""

attributeFormDefault="qualified" elementFormDefault="qualified">

<xs:import namespace=""
<xs:import namespace=""

<xs:element name="A">
<xs:element name="Header" minOccurs="0" maxOccurs="unbounded">
<xs:attribute name="message-class" form="unqualified" type="xs:string" />
<xs:attribute name="message-id" form="unqualified" type="xs:long" />
<xs:attribute name="message-date" form="unqualified" type="xs:dateTime" />
<xs:element name="Data" minOccurs="1" maxOccurs="1">
<xs:element name="B" type="itmB:B"/>
<xs:element name="C" type="itmC:C"/>

Also here is sample of the schema B

<xs:schema id="B"
elementFormDefault="qualified" attributeFormDefault="qualified"
<xs:element name="B" msdata:IsDataSet="true">
<xs:choice maxOccurs="unbounded">
<xs:element name="Title">
Rizwan Patel
Ranch Hand

Joined: Jan 03, 2008
Posts: 59

What error you are getting when using JAXB?

scjp 1.5, OCPJWSD 5
g tsuji
Ranch Hand

Joined: Jan 18, 2011
Posts: 590
In any case, this:
<xs:element name="B" type="itmB:B"/>

should be read:

Same for itmC:C if the schema C follows the same pattern as schema B. The reason basically is that you have defined global element B rather than global type B in the schema B.
david fields

Joined: Jun 06, 2011
Posts: 7
this schema tutorial will help.
Have you checked out Aspose?
subject: xml schema question
It's not a secret anymore!