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