S
Sipayi
'lo!
Trying to use JAXB for my project. I did the following steps:
a. Created xml/xsd/xjb, placed it under "com.foo.blah"
b. xjc'd the xmls into "com.foo.blah.jaxb"
c. Tried to unmarshal:
--
1. JAXBContext jc = JAXBContext.newInstance("com.foo.blah.jaxb");
2. Unmarshaller um = jc.createUnmarshaller();
3. Object xmlData = unmarshaller.unmarshal(com.foo.blah.SomeClass.class.getResourceAsStream("abc.xml"));
--
Line 3. throws
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:173)
....
I presume this means the classloader of SomeClass is unable to locate
the XML file. I have tried placing the xml file in all directories...
\, com\, com\foo, com\foo\blah, com\foo\blah\jaxb, etc., in vain.
Can anyone tell me where I am going wrong?
Is this a locating/loading issues, or JAXB related? Am I using a wrong
class for loading? Shouldn't using a class at the level "com.foo.blah"
suffice in loading "com\foo\blah\abc.xml"?
Thanks in advance.
-Siplin
Trying to use JAXB for my project. I did the following steps:
a. Created xml/xsd/xjb, placed it under "com.foo.blah"
b. xjc'd the xmls into "com.foo.blah.jaxb"
c. Tried to unmarshal:
--
1. JAXBContext jc = JAXBContext.newInstance("com.foo.blah.jaxb");
2. Unmarshaller um = jc.createUnmarshaller();
3. Object xmlData = unmarshaller.unmarshal(com.foo.blah.SomeClass.class.getResourceAsStream("abc.xml"));
--
Line 3. throws
at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:173)
....
I presume this means the classloader of SomeClass is unable to locate
the XML file. I have tried placing the xml file in all directories...
\, com\, com\foo, com\foo\blah, com\foo\blah\jaxb, etc., in vain.
Can anyone tell me where I am going wrong?
Is this a locating/loading issues, or JAXB related? Am I using a wrong
class for loading? Shouldn't using a class at the level "com.foo.blah"
suffice in loading "com\foo\blah\abc.xml"?
Thanks in advance.
-Siplin