Thanks for the reply from both Mattias and Christian. Thank you very much.
----- Original Message ----- From: "Christian Niles" <[EMAIL PROTECTED]> To: "Lee Peik Feng" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, December 01, 2003 9:18 PM Subject: Re: [dom4j-user] The entity name must immediately follow the '&' in the entity reference > The best solution is to get the other program fixed, though the Tidy > program does provide the ability to repair broken HTML/XML documents: > > http://tidy.sourceforge.net/ > > christian. > > On Monday, December 1, 2003, at 02:32 AM, Lee Peik Feng wrote: > > > Hi, > > I have an XML file containing the line as follow: > > <Param Name = "Artist" Value = "Jacky Cheung & Pang" /> > > > > When I try to parse the file > > SAXReader reader = new SAXReader(); > > Document document = reader.read(myfile); ---> error occur here > > > > I get the error below: > > org.dom4j.DocumentException: Error on line 45 of document : The > > entity name > > must immediately follow the '&' in the entity reference. Nested > > exception: > > The entity name must immediately follow the '&' in the entity > > reference. > > at org.dom4j.io.SAXReader.read(SAXReader.java:339) > > at org.dom4j.io.SAXReader.read(SAXReader.java:256) > > > > I understand that when parser encounters the special char "&", it > > expects an > > entity reference. > > > > By changing the "&" to "&" could solve my prob but the XML file is > > generated by another program. > > > > Currently I will read the xml file, assign the content to a String and > > then > > replace all "&" but this method is not secure as if the "&" do mean an > > entity reference, then I'll get error. > > > > How could I overcome this issue? Any workaround? > > > > Any help is appreciated. Thank you. > > > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: SF.net Giveback Program. > > Does SourceForge.net help you be more productive? Does it > > help you create better code? SHARE THE LOVE, and help us help > > YOU! Click Here: http://sourceforge.net/donate/ > > _______________________________________________ > > dom4j-user mailing list > > [EMAIL PROTECTED] > > https://lists.sourceforge.net/lists/listinfo/dom4j-user > > > > ------------------------------------------------------- > This SF.net email is sponsored by: SF.net Giveback Program. > Does SourceForge.net help you be more productive? Does it > help you create better code? SHARE THE LOVE, and help us help > YOU! Click Here: http://sourceforge.net/donate/ > _______________________________________________ > dom4j-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/dom4j-user ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ dom4j-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dom4j-user