I’m trying to parse an XML document that has an attribute called “link” which provides a URL string. The problem is, whenever the URL string includes an & symbol – for example:
http://www.site.com/segment/page.html#/?view=viewName&model=4
The xml parsing breaks and won’t parse anything beyond this node. Here’s my code:
parseVehicles: function(xmlNode) {
$j(xmlNode).children().each(function() {
console.log(supertree.vehicleCount);
supertree.vehicleCount++;
});
},
How do I keep this from breaking?
If your XML looks like this:
Then that’s simply invalid XML. The
&should be escaped:Fix whatever’s creating the invalid XML.