XMLReader's parse method accepts a string URI, so your file
specification is wrong.
Should be something like:
reader.parse("file:///home/colo/PlatformCatalogue.xml");
________________________________
From: Adrian Colomitchi [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 06, 2007 4:56 AM
To: [email protected]
Subject: Re: Instanciate Java classes from XML instances (classes from
wsdl2java)
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: Re: Instanciate Java classes from XML
instances (classes from wsdl2java)
<http://www.nabble.com/Instanciate-Java-classes-from-XML-instances-%28cl
asses-from-wsdl2java%29-tf3877102.html#a10987143>
Sent from the Axis - User mailing list archive
<http://www.nabble.com/Axis---User-f232.html> at Nabble.com.