This discussion is archived
8 Replies Latest reply: Jan 7, 2013 1:15 AM by Ajay Sharma RSS

Getting exception org.xml.sax.SAXParseException while reading XML file.

Ajay Sharma Newbie
Currently Being Moderated
Hi,

I have a following xml File:
<?xml version='1.0' encoding='UTF-8'?>
<Log
     ><INFO
          >
          <TIME_STAMP>2013-Jan-01 11:01:547</TIME_STAMP>
          <DATABASE_NAME>test</DATABASE_NAME>
          <METHOD_NAME>validateUserConnection</METHOD_NAME>
          <MESSAGE>Connection established.</MESSAGE>
     </INFO>
</Log>
<Log
     ><ERROR
          ><USER_NAME></USER_NAME>
          <TIME_STAMP>2013-Jan-01 11:01:579</TIME_STAMP>
          <DATABASE_NAME>test</DATABASE_NAME>
          <METHOD_NAME>validateUserConnection</METHOD_NAME>
          <MESSAGE>Connection Failed.</MESSAGE>
     </ERROR>
</Log>
When I am trying to read this file I am getting following exception
[Fatal Error] log_2013-Jan-01.xml:14:2: The markup in the document following the root element must be well-formed.
Exception in thread "main" org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed.
Reagrds,
Ajay

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points