Reputation: 491
I'm instructed to make an ajax call to read my xml. When I try to do so I get an parsererror.
When I run my xml through a validator, it appears to be correct.
this is my XML:
<?xml version="1.0" encoding="UTF-8"?>
<webservices>
<flickr>
<api>
<key>
***
</key>
<secret>
***
</secret>
</api>
<url>
<api-url>
https://api.flickr.com/services/rest/?method=flickr.photos.search
</api-url>
<attr>
tags=
</attr>
<attr>
has_geo=1
</attr>
<attr>
per_page=4
</attr>
</url>
</flickr>
</webservices>
ajax request:
var getFlickrApi = function(){
$.ajax({
url: 'assets/xml/config.xml',
dataType: 'xml',
success: handleXML,
error: handleError
});
};
var handleXML = function(data){
console.log(data);
};
var handleError = function(xhr, error, message){
console.log(error, message);
};
error message:
message: "Invalid XML: <webservices>↵ <flickr>↵ <api>↵ <key>↵ ***↵ </key>↵
Upvotes: 0
Views: 4237
Reputation: 491
This issue is resolved by simply clearing my cache. It seemed that my ajax call was accessing my previous (incorrect) xml document which was stored in cache.
Thanks for everyone who was trying to help me out.
Upvotes: 0
Reputation: 196236
Assuming that the ***
is not what is really in the xml, you must make sure that the chars in there are allowed.
For example characters like <>&
must be encoded.
Upvotes: 1