Hi, you say you have an xml file, but you really don't according to:

http://www.w3.org/TR/REC-xml#syntax

/ Mattias Reichel

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:dom4j-user-
> [EMAIL PROTECTED] On Behalf Of Lee Peik Feng
> Sent: den 1 december 2003 08:33
> To: [EMAIL PROTECTED]
> Subject: [dom4j-user] The entity name must immediately follow the '&' in
> the entity reference
> 
> 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 "&amp;" 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

Reply via email to