ign-argentina/argenmap

WMS layers aren't showing in menu as capabilities XML parsing fails

Closed this issue · 1 comments

Problem detected:
Layers can't be added to menu as the capabilities XML parsing fails. XML is treated as text, and at some point it is encoded changing the expected XML syntax in other characters not supported by the actual basic text search for layers parameters.

Possible solution:
Refactor WMS parsing function using DOMParser to handle the XML response instead converting it to text. This would avoid the automatic 'URI encoding' of text.

GSC996 commented

To fix it, the code that was using jQuery has been entirely replaced with pure JavaScript. Requests (fetch) will now be made to the service's host, and the resulting XML will be parsed using DOMParser. Additionally, code has been added to identify and handle errors in the service's responses, providing information about the specific layer of the service where the error occurred.