Hi I am a newbie to xml parsing. I am using DOM4J with Jdeveloper. I get the "The entity name must immediately follow the '&' in the entity reference.
" error while trying to parse sml document.
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder db = dbf.newDocumentBuilder();
InputStream input = new FileInputStream(
new File("c:/Patients.xml"));
//parse using builder to get DOM representation of the XML file
dom = (Document)db.parse(input);
} catch (ParserConfigurationException pce) {
System.out.print("ParserConfigurationException");
// pce.printStackTrace();
} catch (SAXException se) {
// System.out.print("SAXException");
se.printStackTrace();
} catch (IOException ioe) {
System.out.print("IOException");
// ioe.printStackTrace();
}
System.out.print(dom);
[Fatal Error] :411:15: The entity name must immediately follow the '&' in the entity reference.
org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
at com.psychez.psychezxml.MainClass.parseXMLFile(MainClass.java:44)
at com.psychez.psychezxml.MainClass.<init>(MainClass.java:27)
at com.psychez.psychezxml.MainClass.main(MainClass.java:31)
Thanks in advance
Venkat
Edited by: pushinglimits on Dec 15, 2008 5:43 PM