I've been attempting to locate an xml node using an xpath query, but I'm having trouble getting it to work. When I try in Firefox, the result is always "undefined" and Chrome throws an error code.
<script type="text/javascript">
var xmlString = '<form><name>test</name></form>';
var doc = new DOMParser().parseFromString(xmlString,'text/xml');
var result = doc.evaluate('/form/name', doc,
null, XPathResult.ANY_TYPE, null);
alert(result.stringValue);
</script>
Can anyone help me identify what's wrong with this code?