You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Joel Thompson <jo...@rhinosystemsinc.com> on 2002/04/15 22:30:22 UTC

parseing input stream instead of file and getting exception...

Hello,

I am sending the exact same XML message through
an input stream instead of a file, and getting the following
errors (SAXParsException):

Document root element is missing.

Here is the code:
// p_sMessage is a String that contains the entire contents
// of the file aeMessage.xml

DocumentBuilder builder = factory.newDocumentBuilder();
ByteArrayInputStream is=new ByteArrayInputStream(
						p_sMessage.getBytes());
m_document =builder.parse(is);
// you now have a dom compliant Document Object

/* THIS WORKS HERE
m_document = builder.parse( new 
File("C:\\joel\\samples\\xml-dom\\aeMessage.xml") );
*/

Can someone please assist?
ENV: jdk1.3, xerces.jar (I believe from sun???), on Windows XP (or 2k)

Thanks,
Joel
-- 
President / Sr. Engineer
RHINO Systems Inc.
Consulting For Your Business
Project Manager &
     Programmer {JAVA & J2EE,ORACLE,HTML & JAVASCRIPT,
                UNIX,C/C++, ESRI-GIS, SMART CARDS}
http://www.rhinosystemsinc.com
530-888-6248 x205
650-366-5885 x205


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: parseing input stream instead of file and getting exception...

Posted by Joel Thompson <jo...@rhinosystemsinc.com>.
sorry for the trouble.

I was receiving the string off of JMS, and when
I toString() the message, it put the id of the message
in the resulting string, I fixed it by
msg.getText().toString() and then it worked fine.

Cheers,
Joel
-- 
President / Sr. Engineer
RHINO Systems Inc.
Consulting For Your Business
Project Manager &
     Programmer {JAVA & J2EE,ORACLE,HTML & JAVASCRIPT,
                UNIX,C/C++, ESRI-GIS, SMART CARDS}
http://www.rhinosystemsinc.com
530-888-6248 x205
650-366-5885 x205


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org