axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Colomitchi <acolomit...@gmail.com>
Subject Re: Instanciate Java classes from XML instances (classes from wsdl2java)
Date Wed, 06 Jun 2007 11:56:00 GMT

I'm battling with the same problem for some time now (like 3-4 hours).
Assuming PlatformCatalogue is a class generated by AXIS, I'm circling the
following piece of code (on the idea that BeanDeserializer is a
org.xml.sax.helpers.DefaultHandler):
 

	TypeDesc plCatTypeDesc=PlatformCatalogue.getTypeDesc();
	BeanDeserializer deserializer=
		new BeanDeserializer(PlatformCatalogue.class, plCatTypeDesc.getXmlType(),
plCatTypeDesc);
	XMLReader reader;
	try {
		reader = XMLReaderFactory.createXMLReader();
		reader.setContentHandler(deserializer);
		reader.setErrorHandler(deserializer);
		reader.setEntityResolver(deserializer);
		reader.setDTDHandler(deserializer);
		reader.parse("/home/colo/PlatformCatalogue.xml");
		PlatformCatalogue toUse=(PlatformCatalogue)deserializer.getValue();
	} catch (SAXException e) {
		e.printStackTrace();
	}
	catch (IOException ioe) {
		ioe.printStackTrace();
	}

Now, I my mind, the above should work, but in reality it doesn't!!

No exception thrown, however the loaded PlatformCatalogue instance is empty
(no inner elements are created/set). What's wrong with it? I swear the XML
file does have a valid and non-empty content for the  root tag.
It drives my crazy, I'll end totaly bald!! Someone, please help!

Best regards and thanks in advance,
Adrian


Florent Georges wrote:
> 
>   Hi
> 
> 
I looked in the archives for an answer to my problem, but
> I didn't find anything.  Actually I saw several similar
> questions but they were never answered.
> 
> 
I have generated binding classes with wsdl2java.  For
> tests, I have XML documents on the file system, and I'd like
> to get the corresponding Java objects (instances of the
> classes generated by wsdl2java).
> 
> 
I guess that would be easy with Axis, but I didn't find
> the way to go.  I use Axis 1.4.
> 

-- 
View this message in context: http://www.nabble.com/Instanciate-Java-classes-from-XML-instances-%28classes-from-wsdl2java%29-tf3877102.html#a10987143
Sent from the Axis - User mailing list archive at Nabble.com.

Mime
View raw message