Many times, there is a requirement to parse XML response. By parsing, we mean taking out the required information from a bunch of coded data. In this situation, we will already have the XML response in a variable. In the syntax and examples given below, we will parse required data from an XML code.
If you already have your XML data in a variable e.g. input.
Then, to parse we will write given code:
parser = new DOMParser();
xmlDoc = parser.parseFromString(input,”text/xml”);
The output is highlighted above.