Lukas,

Looks like you got it all taken care of in the annotations as well. That
should take care of all the problems I had. Seems version 3.0 has quite a
bit of changes. So I think i am gonna stick with 2.x version with a
walk-around on the Settings part for now.

Great work!

Thanks,
Sean


On Tue, Dec 18, 2012 at 1:35 AM, Lukas Eder <[email protected]> wrote:

> Hello Sean, (sorry for the double E-Mail)
>
> > I gets some similar validation error from the
> DefaultValidationEventHandler.
> > It seems JAXB is does the validation by inspecting the Settings class
> > instead of reaching out to find the actual .xsd file. This might be the
> > reason why unmarshaling returns a incomplete Setting object(packed with
> > default values).
>
> Did you re-generate the code in org.jooq.conf? Specifically, the
> package-info.java should now read:
>
> @javax.xml.bind.annotation.XmlSchema(namespace =
> "http://www.jooq.org/xsd/jooq-runtime-3.0.0.xsd";, elementFormDefault =
> javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
> package org.jooq.conf;
>
> As you can see, the elementFormDefault has found its way into the
> annotations
>
> > As you may have already been aware, the Settings class probably also
> needs
> > to by fixed in some way so that the unmarshaling can work correctly. Let
> me
> > know if I am understanding anything wrong here.
>
> Your code example seems to have worked for me. What's the error you're
> getting?
>
> > Also, I am kind new to GitHub, is there a way I can pack and use the
> current
> > master copy before JOOQ 3.0 actually got released.
>
> You should install Maven and build all the jooq deliverables. Another
> option is to wait for me to publish a SNAPSHOT on the Sonatype
> repositories. I do so infrequently (around once a week...). The
> snapshot repositories are located here:
> https://oss.sonatype.org/content/repositories/snapshots/org/jooq/
>
> Cheers
> Lukas
>
> 2012/12/18 Sean Qiu <[email protected]>:
> > Lukas,
> >
> > Thanks for taking some actions on the issue I reported. I really
> appreciate
> > that.
> >
> > When I was testing with unmarshaling the settings xml file with JAXB with
> > the following piece of code:
> >
> > JAXBContext jc;
> >
> > Unmarshaller u;
> >
> > Settings s;
> >
> > try {
> >
> > jc = JAXBContext.newInstance( "org.jooq.conf");
> >
> > u = jc.createUnmarshaller();
> >
> > u.setEventHandler(new
> > javax.xml.bind.helpers.DefaultValidationEventHandler());
> >
> > JAXBElement<Settings> j = (JAXBElement<Settings>) u.unmarshal( new File(
> > "./jooq-runtime.xml" ) ); // ok
> >
> > s = j.getValue();
> >
> > } catch (JAXBException e1) {
> >
> > // TODO Auto-generated catch block
> >
> > e1.printStackTrace();
> >
> > }
> >
> >
> > I gets some similar validation error from the
> DefaultValidationEventHandler.
> > It seems JAXB is does the validation by inspecting the Settings class
> > instead of reaching out to find the actual .xsd file. This might be the
> > reason why unmarshaling returns a incomplete Setting object(packed with
> > default values).
> >
> >
> > As you may have already been aware, the Settings class probably also
> needs
> > to by fixed in some way so that the unmarshaling can work correctly. Let
> me
> > know if I am understanding anything wrong here.
> >
> >
> > Also, I am kind new to GitHub, is there a way I can pack and use the
> current
> > master copy before JOOQ 3.0 actually got released.
> >
> >
> > Thanks,
> >
> > Sean
> >
> >
> >
> > On Fri, Dec 14, 2012 at 5:56 AM, Lukas Eder <[email protected]>
> wrote:
> >>
> >> Hello Sean,
> >>
> >> This is fixed on GitHub master and will be included in jOOQ 3.0
> >>
> >> Cheers
> >> Lukas
> >>
> >> 2012/12/13 Lukas Eder <[email protected]>:
> >> > Hello Sean,
> >> >
> >> > I'm CC'ing this message to the user group, as I think it may be of
> >> > interest to a larger audience.
> >> > So far, I hadn't validated jOOQ's code generation / runtime
> >> > configuration against the XSD specification that I have published.
> >> > You're probably right, elementFormDefault="qualified" should be
> >> > specified as such. I have registered #2008 for this:
> >> > https://github.com/jOOQ/jOOQ/issues/2008
> >> >
> >> > Cheers
> >> > Lukas
> >> >
> >> > 2012/12/13 Sean Qiu <[email protected]>:
> >> >> Hello Lukas,
> >> >>
> >> >> I've been using JOOQ with one of our projects. Everything has been
> >> >> working great and I like it a lot.
> >> >> There is one issue I did ran into to lately which is about loading
> >> >> schema mapping configuration from the xml file into a Settings
> object.
> >> >>
> >> >> When I follow the xml example you have in the manual and validate
> >> >> against "http://www.jooq.org/xsd/jooq-runtime-2.5.0.xsd";, it fails.
> >> >>
> >> >> Here the xml contents I got:
> >> >>
> >> >> <settings xmlns="http://www.jooq.org/xsd/jooq-runtime-2.5.0.xsd";>
> >> >>         <renderMapping>
> >> >>                 <schemata>
> >> >>                         <schema>
> >> >>                                 <input>dev</input>
> >> >>                                 <output>my_schema</output>
> >> >>                                 <tables>
> >> >>                                         <table>
> >> >>                                                 <input>table</input>
> >> >>
> >> >> <output>my_table</output>
> >> >>                                         </table>
> >> >>                                 </tables>
> >> >>                         </schema>
> >> >>                 </schemata>
> >> >>         </renderMapping>
> >> >> </settings>
> >> >>
> >> >> The error message is:Error - Line 2, 17:
> org.xml.sax.SAXParseException;
> >> >> lineNumber: 2; columnNumber: 17; cvc-complex-type.2.4.a: Invalid
> content was
> >> >> found starting with element 'renderMapping'. One of '{renderSchema,
> >> >> renderMapping, renderNameStyle, renderKeywordStyle, renderFormatted,
> >> >> statementType, executeLogging, executeListeners,
> >> >> executeWithOptimisticLocking, attachRecords}' is expected.
> >> >>
> >> >> If I add elementFormDefault="qualified" in the xsd file you provide,
> >> >> the validation will succeed.
> >> >>
> >> >> I got the same error either when doing the validation on
> >> >> http://www.utilities-online.info/xsdvalidation/#.UMlnoKWVtAS
> >> >> or when I am unmarshaling the settings in Java and with JAXB debug
> mode
> >> >> turned on.
> >> >>
> >> >>  So my question is has anyone else ran into the same issue as I did,
> >> >> and if it is possible to add the elementFormDefault="qualified"
> option into
> >> >> the xsd file.
> >> >>
> >> >> Thanks,
> >> >> Sean
> >> >>
> >> >>
> >
> >
> >
> >
> > --
> > Sean
>



-- 
Sean

Reply via email to