users@jaxb.java.net

Re: trouble editing xjb file in eclipse. does not not about jaxb and xjc types.

From: Ioannis Mavroukakis <imavroukakis_at_gmail.com>
Date: Wed, 30 May 2012 22:20:22 +0100

Hi Andy,

I regularly use Eclipse+Maven+jaxb/xjc together, mostly in glorious
harmony. When they work together well, it's sweetness and light, and when
they don't, well I want to stab bunnies, but that's rarer nowadays.
If I understand correctly you want to employ Eclipse's context sensitivity
and auto-completion to aid your bindings declaration. Eclipse obviously
does that out of the blocks with XSD and if I am not mistaken, this is
because it has already cached the DTD. If you go to Eclipse's Preferences
-> XML -> XML Catalog you will see all the DTD's that Eclipse employs to
assist you. Perhaps if you add the ones you need in that list, you will get
the desired effect. Eclipse can't help you if it doesn't have the grammar
to verify against.

Now, in terms of actually working with the Eclipse/Maven/jaxb triad..I have
found since migrating to Eclipse 3.7 , with it's inbuilt Maven support via
M2E plugins (which includes code generation support) my life has become
immensely easier. I change something at my bindings or xsd file and if I
don't see the desired effect on the code, I know I've mucked something up,
in which case I simply right click on the project, and select Generate
Sources from the Maven sub-context menu and watch the xjc output.

I know it's not much to go on, but I hope it helps you.

Cheers,

Ioannis


On 30 May 2012 18:42, Andy Davidson <andy_davidson_at_apple.com> wrote:

> Hi Wolfgang
>
> I did not explain what we are trying to do very well. We want to
> create/maintain/edit the xjb file using an XML, DTD, XSD aware editor like
> eclipse. These editors will make it much faster and easier for catch bugs.
> We build our project using Maven. For unknown reasons the xjc errors where
> not showing up in our build logs. I discovered the bugs by running xjc on
> the command line. You are correct. when run from the command line xjc did a
> good job of reporting errors. Most of the problems where related file name
> changes.
>
> Bellow is a more complete example of our actual xjc file. I deleted most
> of the contents. eclipse does not know what types are allowed.
> <jaxb:bug>hello world</jaxb:bug> will not cause an error.
>
> eclipse generates a wanring "No grammer constraints (DTD or XML Schema)
> detected for the document" thats it. As long as the xml is well formed
> eclipse does not complain.
>
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <jaxb:bindings version="2.0"
> targetNamespace="http://www.apple.com/xxx"
> xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:pos="http://www.Apple.com/xxx"
> jaxb:extensionBindingPrefixes="xjc">
>
>
>