Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Re: The entity name must immediately follow the '&' in the entity reference

venkatramakkineniDec 15 2008 — edited Jul 30 2009
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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 27 2009
Added on Dec 15 2008
10 comments
10,420 views