commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Qaiser Mehmood" <Qaiser.Mehm...@revolution.com>
Subject RE: help for error The root element is required in a well-formed document
Date Mon, 10 Apr 2006 19:54:51 GMT
I am trying to convert XML file to Java Bean and using this code :

	        StringReader xmlReader = new StringReader(xml);
	        
	        
	        BeanReader beanReader  = new BeanReader();
	        
	       beanReader.registerBeanClass("message",Message.class);
	        
	        
	        // Now we parse the xml
	        message = (Message) beanReader.parse(xmlReader);

Getting error:

pr 10, 2006 3:21:00 PM org.apache.commons.digester.Digester fatalError
SEVERE: Parse Fatal Error at line 1 column 1: The root element is
required in a well-formed document.
org.xml.sax.SAXParseException: The root element is required in a
well-formed document.



-----Original Message-----
From: Mark A Fortner [mailto:phidias51@yahoo.com] 
Sent: Monday, April 10, 2006 3:46 PM
To: Jakarta Commons Users List
Subject: Re: help for error The root element is required in a
well-formed document

That's odd.  The elements should form a well-formed
document -- the position of the root element on a new
line shouldn't make any difference.  One could have a
document generated by a Windows box, read by a Linux
box and the returns would be messed up. Are you saying
that you would expect such an eventuality to cause a
document to fail to be parsed?

--- Craig McClanahan <craigmcc@apache.org> wrote:

> On 4/10/06, Qaiser Mehmood
> <Qaiser.Mehmood@revolution.com> wrote:
> >
> > Hi ,
> >
> >
> >
> > I am trying to parse this XML File to a Java Bean
> and getting this error
> > :
> >
> >
> >
> > Apr 10, 2006 2:25:26 PM
> org.apache.commons.digester.Digester fatalError
> >
> > SEVERE: Parse Fatal Error at line 1 column 1: The
> root element is
> > required in a well-formed document.
> >
> > org.xml.sax.SAXParseException: The root element is
> required in a
> > well-formed document.
> >
> >       at
> >
>
org.apache.xerces.framework.XMLParser.reportError(XMLParser.java:1196)
> >
> >
> >
> >
> >
> > XML File is
> >
> >
> >
> > <?xml version="1.0" ?>  <Message id="1">
> 
> 
> The error message means what it says :-).  Since
> your file ends with
> "</Message>", you need the <Message> element here,
> but XML syntax requires
> that it be on a separate line in order to be
> recognized.
> 
>     <application_name>Find Doc</application_name>
> >
> >     <createDate>2006-04-10
> 14:25:26.062</createDate>
> >
> >     <createdBy>1</createdBy>
> >
> >     <id>0</id>
> >
> >     <index_page>index.jsp</index_page>
> >
> >     <message_text>Error on
> Index.jsp</message_text>
> >
> >     <priority>5</priority>
> >
> >     <signature>Revolution Team</signature>
> >
> >     <user_id>1</user_id>
> >
> >   </Message>
> 
> 
> Craig
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message