Solved

JAXB question

Posted on 2003-10-28
5
456 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
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…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

773 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