Ashley Williams wrote:
I've just finished changing over my code from sun jaxb to jaxme and
straight away my test suite fails complaining that
my xml file doesn't contain a root element:
org.xml.sax.SAXParseException: Document root element is missing.
at org.apache.crimson.parser.Parser2.fatal(Parser2.java:3376)
This error message is the Crimson error code P-067. It indicates, that
the XML parser either doesn't see the "<services" part or that there is
some non-whitespace character before.
This is *not* a JaxMe error message. In fact, the error is reported,
before JaxMe gets to see any SAX events.
From the line numbers, I can see that you are using the method
unmarshal(InputStream)
My guess is, that the data floating through the input stream is not what
you expect it to be.
When in doubt, try to replace
Object result = unmarshaller.parse(istream);
with the following code:
String fileName = "/tmp/test.xml"; // c:/temp/test.xml for Windows
FileOutputStream f = new FileOutputStream(fileName);
byte[] buffer = new byte[1024];
for (;;) {
int res = istream.read(buffer);
if (res == -1) { break; }
f.write(buffer, 0, res);
}
f.close();
Object result = unmarshaller.parse(new FileInputStream(fileName));
and inspect the file. If you still believe, there's an error, file a bug
report with the contents of test.xml and your schema.
Jochen
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]