Solved

JAXB question

Posted on 2003-10-28
5
478 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
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:

717 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