Solved

JAXB question

Posted on 2003-10-28
5
433 Views
Last Modified: 2008-03-06
Hello,

I have a JAXB question that I'd really like to go through with someone.

It's here:

http://www.experts-exchange.com/Web/Web_Languages/XML/Q_20778894.html

I'd also like to increase the number of points for the question.  How can I do this?

Thanks
TimB
0
Comment
Question by:TimB
  • 3
  • 2
5 Comments
 
LVL 1

Author Comment

by:TimB
Comment Utility
Is anybody there?  even some pointers would be great.

TimB
0
 
LVL 3

Expert Comment

by:savalou
Comment Utility
Can you post the xsd file you're trying to transform?
0
 
LVL 1

Author Comment

by:TimB
Comment Utility
I've posted the details on the original question here:

http://www.experts-exchange.com/Web/Web_Languages/XML/Q_20778894.html

Thanks,
TimB
0
 
LVL 3

Accepted Solution

by:
savalou earned 500 total points
Comment Utility
Is it ok if I post here, I'm more often in the Java section than XML.

Ok, a couple of things.  To suppress the ct-props-correct.4 error, do this to build.xml

        <xjc binding="bindings.jxb" extension="true" package="ee" schema="profile.xsd" target=".">
          <arg value="-nv"/>
        </xjc>

That just solves the problem initially so that xjc can get on to the bindings, because otherwise it doesn't even see the bindings customization file.

To target the included schema would have been to have a <jxb:bindings schemaLocation="FIDELIO..."> section.  I don't know if that was your question about how to tell xjc to ignore the included definitions, but anyway, this too doesn't work.

That CreditCard definition in profile.xsd is definitely a problem.  I've looked at it more than I should have and it's a stumper.  Maybe there's a correct solution but all I have is a workaround.  Your profile.xsd is an xml file after all and subject to xsl transformation.  So put it through a transformation which leaves everything in except the  commented line below.  

...
     <xs:element name="CreditCards">
          <xs:annotation>
               <xs:documentation>Collection of Credit Card objects (CreditCard.xsd)</xs:documentation>
          </xs:annotation>
          <xs:complexType>
               <xs:sequence>
                    <xs:element name="CreditCard" maxOccurs="unbounded">
                         <xs:complexType>
                              <xs:complexContent>
                                   <xs:extension base="CreditCard">
                                        <!-- <xs:attributeGroup ref="PrivacyAttributes"/>  privacy killed -->
                                   </xs:extension>
                              </xs:complexContent>
                         </xs:complexType>
                    </xs:element>
               </xs:sequence>
               <xs:attributeGroup ref="PrivacyAttributes"/>
          </xs:complexType>
     </xs:element>
...

Then run xjc.  

That's it.
0
 
LVL 1

Author Comment

by:TimB
Comment Utility
Wow!

I knew about the "~<arg value="-nv"/>" part, but didn't work out the xml part that you did.

However, I did manage to convert the XSDs using Castor and a castor bindings file.  

Even though I got Castor to convert, I am tempted to use your way, as JAXB is the standard.

Thanks for all the help,

TimB
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now