Solved

JAXB question

Posted on 2003-10-28
5
470 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
ID: 9635153
Is anybody there?  even some pointers would be great.

TimB
0
 
LVL 3

Expert Comment

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

Author Comment

by:TimB
ID: 9648630
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
ID: 9658881
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
ID: 9670822
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
hibernate insert example 13 37
check java version using powershell 13 279
Better way to make a string with template variables in java 3 31
Selenium docs api java index 3 63
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

680 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