In XML strings, the &
character must use the &
entity.
Your string should be:
"http://xxx.xxx.xx.xxx:89/broadwave.mp3?src=1&rate=1&ref=http%3A%2F%2F111.92.240.134%3A89%2F"
문제
I'm trying to parse the following XML using JDOM:
<ASX version = "3.0" BANNERBAR="fixed">
<TITLE>HM FM 104.5</TITLE>
<ENTRY>
<TITLE>HM FM 104.5</TITLE>
<BANNER HREF = "http://xxx.xxx.xx.xxx:89/asxbanner.jpg">
<moreinfo href = "http://www.nch.com.au/index.html" />
<abstract>Click here to go to http://www.nch.com.au/index.html</abstract>
</BANNER>
<REF HREF = "http://xxx.xxx.xx.xxx:89/broadwave.mp3?src=1&rate=1&ref=http%3A%2F%2Fxxx.xxx.xx.xxx%3A89%2F" />
</ENTRY>
</ASX>
My issue is the line containing "src=1&rate=1&ref=http%3A%2F" appears to cause the following exception:
Caused by: org.xml.sax.SAXParseException: The reference to entity "rate" must end with the ';' delimiter.
Here is the code:
SAXBuilder builder = new SAXBuilder();
Reader in = new StringReader(xml);
Document doc = null;
Element root = null;
doc = builder.build(in); // this line throws the Exception
It appears JDOM doesn't like the '&' or '=' character. How can I use JDOM to successfully parse this XML?
해결책
In XML strings, the &
character must use the &
entity.
Your string should be:
"http://xxx.xxx.xx.xxx:89/broadwave.mp3?src=1&rate=1&ref=http%3A%2F%2F111.92.240.134%3A89%2F"