Hello Guys,
I’m playing around with org.springframework.oxm.jibx.JibxMarshaller the thing
is
when I’m generating code from XSD files, the binding factory class file
“JiBX_bindinFactory.class” is
being created with empty package. I have different packages on the XSD let’s
say:
"com.example.model" and “org.otherexample.app” so when the binding is created
the package attribute
is empty. the following problem I’m having is that JibxMarshaller is not able
to accept null targetPackage
if you see the code for that class when creating the bindingFactory instance
(line 229) the class BindingDirectory
getFactory(bname, pack) line 233, can accept null package, but as JiBX
Marshaller is not accepting null I have to
pass empty string, which makes the getFactory assume that we are passing a
package and appends the “.”
resulting on .JiBX_bindingFactory which does not exists.
I find this behavior contradictory. I have not been able to find a way to force
using jibx maven plunging to create the
binding.xml with a forced package on the binding definition attribute.
here are the code snippet that I’m talking about:
org.springframework.oxm.jibx.JibxMarshaller
@Override
public void afterPropertiesSet() throws JiBXException {
if (this.targetClass != null) {
if (StringUtils.hasLength(this.bindingName)) {
if (logger.isInfoEnabled()) {
logger.info("Configured for target
class [" + this.targetClass + "] using binding [" + this.bindingName + "]");
}
this.bindingFactory =
BindingDirectory.getFactory(this.bindingName, this.targetClass);
}
else {
if (logger.isInfoEnabled()) {
logger.info("Configured for target
class [" + this.targetClass + "]");
}
this.bindingFactory =
BindingDirectory.getFactory(this.targetClass);
}
}
else if (this.targetPackage != null) {
if (!StringUtils.hasLength(bindingName)) {
bindingName = DEFAULT_BINDING_NAME;
}
if (logger.isInfoEnabled()) {
logger.info("Configured for target package [" +
this.targetPackage + "] using binding [" + this.bindingName + "]");
}
this.bindingFactory =
BindingDirectory.getFactory(this.bindingName, this.targetPackage);
}
else {
throw new IllegalArgumentException("Either
'targetClass' or 'targetPackage' is required");
}
}
org.jibx.runtime.BindingDirectory:
public static IBindingFactory getFactory(String bname, String pack,
ClassLoader loader) throws JiBXException {
String cname = (pack == null ? "" : pack + '.') +
GENERATE_PREFIX + convertName(bname) + BINDINGFACTORY_SUFFIX;
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users