Comments (10)
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.
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.
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.
You can find the use-case project here for a short time.
from jaxb-visitor.
I'll be able to look at this today. Thanks for the sample project and small schema.
from jaxb-visitor.
Try with the latest snapshot. I'll push to maven central in a few days.
from jaxb-visitor.
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.
Would you please push 2.3 to Maven Central? That's either with or without my pull request. Thanks.
from jaxb-visitor.
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.
done
from jaxb-visitor.
Related Issues (16)
- Problems with TraversingVisitor implementation for custom classes HOT 4
- Typed IDREF(S) properties lead to Compile Errors
- Limit Visitor to a Particaular type HOT 5
- DepthFirstTraverserImpl follows IDREFS
- package is not compatible with jdk 10 HOT 4
- jaxb-visitor is not compatible with maven-jaxb2-plugin 0.14.0 HOT 4
- visitor / depth first trasverser with custom class bindings HOT 16
- update to the latest maven testing framework HOT 1
- allow option to only emit interfaces only HOT 1
- support both Jakarta and JDK 8 style dependencies
- NullPointerException when running visitor plugin HOT 4
- add support for a param for visit and traverse generation
- some Jakarta namespaces aren't being checked for legacy flag
- Duplicate methods in visitor HOT 6
- NPE in `ClassDiscoverer::handleXmlElement` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jaxb-visitor.