commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Qaiser Mehmood" <>
Subject help for error The root element is required in a well-formed document
Date Mon, 10 Apr 2006 18:41:36 GMT
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.




XML File is 


<?xml version="1.0" ?>  <Message id="1">

    <application_name>Find Doc</application_name>

    <createDate>2006-04-10 14:25:26.062</createDate>




    <message_text>Error on Index.jsp</message_text>


    <signature>Revolution Team</signature>




And Java code is :


         First construct the xml which will be read in

                    // For this example, read in from a hard coded

                    StringReader xmlReader = new StringReader(xml);


                    // Now convert this to a bean using betwixt

                    // Create BeanReader

                    BeanReader beanReader  = new BeanReader();


                    // Register beans so that betwixt knows what the xml
is to be converted to

                    // Since the element mapped to a PersonBean isn't
called the same, 

                    // need to register the path as well



                    // Now we parse the xml

                    message = (Message) beanReader.parse(xmlReader);


                    System.out.println("message is "+message);


Please help me in this problem.


Qaiser Mehmood

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message