users@jaxb.java.net

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

From: Andy Davidson <andy_davidson_at_apple.com>
Date: Thu, 31 May 2012 11:24:04 -0700

thanks. One we get this figured out maybe we can figure out where to document the solution. I would think anyone using xjc would benefit

andy



On May 31, 2012, at 11:18 AM, Ioannis Mavroukakis wrote:

> Hi Andy, let me give it a spin myself to see if I can coax it into submission. If you prefer we can take this discussion off list while we attempt things, and if there's some success report back.
>
> Cheers,
> Ioannis
>
> On 31 May 2012 18:54, Andy Davidson <andy_davidson_at_apple.com> wrote:
> Hi Ioannis
>
> I configured eclipse as you suggested. It does not seem to help. The eclipse validator does not have any knowledge of xjb related types.
>
> <?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:xxx="http://www.Apple.com/xxx"
> jaxb:extensionBindingPrefixes="xjc">
>
> </jaxb:bindings>
>
>
> . I still get a warning "No grammar constraints (DTD or XML Schema) detected for the document" Its not clear to me how to set my xjb binding file so that it is a valid XML schema or has knowledge of a DTD?
>
> thanks
>
> Andy
>
>
>
>
>
>
>
>> 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">
>>
>>
>
>