Solved

JAXB question

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
configure dependency in POM for new database 3 34
tomcat administrtor 12 61
jboss wildfly 10.1 10 231
Crystal Reports Licensing Questions 4 34
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

860 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