Warning: simplexml_load_string(): Entity: line 432: parser error : EntityRef: expecting ';'

Warning: simplexml_load_string(): Entity: line 432: parser error : EntityRef: expecting ';' 

 

character is used in XML to insert a character reference with syntax &name; (note ; after name). Parser expects a ; but it can't find it (there are more available delimiters, this is just most common case).

Solution is then escaping (how it's done depends on language you use to generate that XML file) but final result must be something like this:

<url>
  <loc>http://www.ezed.in/ezed/courseDemoIntroPage.do?courseId=COU10000000138003530&amp;checkingCourseFrom=preLogin#.U2DcKvmSySo</loc>
</url>

Note that plain & has been replaced with its escaped version &amp;. For further details see this simple article.

Another possible solution (if you don't want/you can't escape) is to enclose URL inside a CDATA section like this:

<url>
  <loc><![CDATA[http://www.ezed.in/ezed/courseDemoIntroPage.do?courseId=COU10000000138003530&checkingCourseFrom=preLogin#.U2DcKvmSySo]]></loc>
</url>
原文链接:http://stackoverflow.com/questions/23422316/xml-validation-error-entityref-expecting
posted @ 2015-12-10 17:21  大匠  Views(1129)  Comments(0Edit  收藏  举报