Question

I am collecting a string from the php through AJAX. This string basically contains the data from a database enclosed within tags (XML structure).

In Javascript I am receiving this string. Now I want to view this string as an XML on the browser just to make sure that XML string is properly formed.

Can anyone suggest me How to convert a string in to proper XML and display it on the web browser ?

Was it helpful?

Solution

if your idea is just to read and see if the xml is correct, you can use console.log to write the xml to log and view it. if you want to get displayed on the browser you can put it in a textarea and see the xml, or if you use loadxml in to a xml document, incase there is an issue it will throw you an error.

let me know if that helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top