Check if a String is HTML or XML

Is there a way to check if a String is HTML or XML in JavaScript? Preferably using jQuery rather than some other library? Why I need to do this is because I need to know if it possible to have a function...