Coder Social home page Coder Social logo

Comments (10)

massfords avatar massfords commented on June 19, 2024

See the README for a link to the JAXB tutorial on JAXBElements. In short, there are tweaks to your schema that you can make to avoid JAXBElements. Of course, changing the schema you're working with is not going to work for everybody. There are some tests in place that show how the plugin correctly handles JAXBElements but it seems like you're either working with an older version or have found a bug.

I'm happy to accept a pull request. If you don't want to do the patch yourself, you should provide me with a sample schema that illustrates the problem. If your schema is proprietary, try to create a small example in a dummy namespace with just enough of the elements to recreate the problem so I can debug it.

from jaxb-visitor.

marcparmet avatar marcparmet commented on June 19, 2024

Well, modifying the schema isn't really practical -- it's from a third party -- and we're using version 2.2 of your tool. The schema is also big. It's imsqti_v2p1.xsd if you're interested. So this appears to be a bug and I'll try to whittle the schema down to a simpler use-case for you.

from jaxb-visitor.

marcparmet avatar marcparmet commented on June 19, 2024

I have a simple, stripped use-case for you. Let me know what you find.

I'll point out one thing. Here's the XSD. The mixed="true" attribute is
critical for producing the problem. I'm guessing the objects that are
created in this case are something you did not anticipate.

<?xml version = "1.0" encoding = "UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

  <xs:element name="body" type="Body.Type"/>
  <xs:element name="p" type="P.Type"/>

  <xs:complexType name="Body.Type" mixed="false">
    <xs:sequence>
      <xs:choice minOccurs = "0" maxOccurs = "unbounded">
        <xs:element ref="p" />
      </xs:choice>
    </xs:sequence>
  </xs:complexType>

  <!-- The attribute mixed="true" is critical for reproducing the bad behavior. -->
  <xs:complexType name="P.Type" mixed="true">
    <xs:sequence>
      <xs:choice minOccurs = "0" maxOccurs = "unbounded">
        <xs:element ref="p" />
      </xs:choice>
    </xs:sequence>
  </xs:complexType>

</xs:schema>

from jaxb-visitor.

marcparmet avatar marcparmet commented on June 19, 2024

You can find the use-case project here for a short time.

from jaxb-visitor.

massfords avatar massfords commented on June 19, 2024

I'll be able to look at this today. Thanks for the sample project and small schema.

from jaxb-visitor.

massfords avatar massfords commented on June 19, 2024

Try with the latest snapshot. I'll push to maven central in a few days.

from jaxb-visitor.

marcparmet avatar marcparmet commented on June 19, 2024

This looks good. I can remove my patch and my JUnit tests all pass.

The generated code, while correct, gives me hundreds of warnings in Eclipse because it's using plain JAXBElement instead of JAXBElement<?>. I sent you a pull request that fixes this.

from jaxb-visitor.

marcparmet avatar marcparmet commented on June 19, 2024

Would you please push 2.3 to Maven Central? That's either with or without my pull request. Thanks.

from jaxb-visitor.

massfords avatar massfords commented on June 19, 2024

will look at this today

On Thu, Jul 9, 2015 at 10:14 AM, Marc Parmet [email protected]
wrote:

Would you please push 2.3 to Maven Central? That's either with or without
my pull request. Thanks.


Reply to this email directly or view it on GitHub
#6 (comment)
.

from jaxb-visitor.

massfords avatar massfords commented on June 19, 2024

done

from jaxb-visitor.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.