Simone Bordet wrote:
Hi Dan !
I tried this code:
XFire xfire = XFireFactory.newInstance().getXFire();
CustomTypeMapping typeMapping = new CustomTypeMapping();
typeMapping.register(Foo.class, new QName("http://foo.com/", "Foo",
"foo"), new FooType());
TypeMappingRegistry typeMappingRegistry = new DefaultTypeMappingRegistry();
typeMappingRegistry.registerDefault(typeMapping);
Maybe try this instead:
TypeMappingRegistry typeMappingRegistry = new DefaultTypeMappingRegistry();
TypeMapping tm = typeMappingRegistry.getDefaultTypeMapping();
Here tm is null, for newly created instances of
DefaultTypeMappingRegistry, hence the line below throws a NPE.
That's why I used registerDefault().
OK, so what you were doign was setting your type mapping as the default
(root) type mapping. Butyou actually neeed that to be a default
typemapping that the TypeMappingRegistry creates with the String, int,
etc types in it.
So try this:
TypeMappingRegistry typeMappingRegistry = new
DefaultTypeMappingRegistry(true);
TypeMapping tm = typeMappingRegistry.getDefaultTypeMapping();
tm.register(fooType);
The "true" in the constructor creates a default type mapping for you.
tm.register(yourType);
I'll try to look in XMLTypeCreator; if getDocument() could be enhanced
to look also in other (configurable) places (and not only in the same
directory of the class), that should be enough for me.
May that be the right direction to look at ?
That could work, but I think the above might be easier.
Cheers,
- Dan
--
Dan Diephouse
(616) 971-2053
Envoi Solutions LLC
http://netzooid.com