The isXMLDoc() method returns a Boolean value and determines whether or not a DOM node is in the XML document or is itself an XML document. If it finds the passed value is an XML document or in the XML document, it returns true. Otherwise, it returns false.
The commonly used syntax of this method is given below -
This method accepts a single parameter which is defined as follows -
node - It specifies the DOM node to check whether it is an XML document or in the XML document.
It is a simple example of using the isXMLDoc() method. In this example, we are using the isXMLDoc() method to determine whether the passed values are in the XML document or itself an XML document. Here, we are passing different values as an argument.
Here, there are two variables, one is storing the XML, and another one is storing the simple string. We are also using the $.parseXML() and $.parseHTML() methods to parse the variables into XML and HTML files. Then we will pass the variables to the isXMLDoc() method to check the results.Test it Now
After the execution of the above code, the output will be -