Hi All
I have an issue with parsing xml with namespaces, namely a gml file.
Worked fine in 1.4.2.
I create an xml document using (I do this because the xml is embedded in a return and doesn't come across as an xml file):
var doc = (new DOMParser()).parseFromString(string, 'text/xml');
I then parse to find the bounding box:
$("[nodeName=gml:Box]", doc).find("[nodeName=gml:coord]").each(function(i) {
....
});
With 1.5 I now get:
Uncaught Syntax error, unrecognized expression: [nodeName=gml:Box] jquery.js line 16
So I escape the : and change it to:
$("[nodeName=gml\\:Box]", doc).find("[nodeName=gml\\:coord]").each(function(i) {
Works fine. However, There is dynamic content in the gml file and I dont know what one of the keys is going to be called until I load it.
The following used to work:
var queryNodeName = "";
$("[nodeName=gml:featureMember]", doc).children().each(function(i) {
queryNodeName = '"[nodeName=' + this.nodeName + ']"';
});
$(queryNodeName, doc).children().each(function(i) {
...
});
Basically, I pull out the nodename and write it into a variable and then use that further down to loop through.
Now it no longer works. If I rewrite the nodeName to include the escaped : it still doesn't work I just get:
Uncaught Syntax error, unrecognized expression: "[nodeName=ogr\\:a13.1__Road_]"
Any ideas.
Simon
PS All worked fine with 1.4.2, however I upgraded to 1.5 to solve a rather nasty bug on IE when parsing XML files. It would just end the document half way through for no apparent reason, worked fine on Firefox, Chrome etc so I cant really go back.