I'm trying to use DOMParser, or XPath to get a XML fragment out of a document. A element with either DOMParser or document.evaluate returns an element with a null nodeValue, how do I get the xml fragment back as a string? Here's the example that I can't get to work in WebKit.
XML:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="contact">
<attribute name="address1_stateorprovince" />
<attribute name="new_source" />
<attribute name="ownerid" />
<attribute name="new_organization" />
<attribute name="new_lastcontacted" />
<attribute name="emailaddress1" />
<attribute name="address1_city" />
<attribute name="telephone1" />
<order attribute="fullname" descending="false" />
<filter type="and">
<condition attribute="new_conflicting" operator="eq" value="1" />
</filter>
<attribute name="fullname" />
<attribute name="new_csuid" />
<attribute name="new_contacttype" />
<attribute name="contactid" />
</entity>
</fetch>
Source:
var parser = new DOMParser();
var filterXmlDoc = parser.parseFromString(xml, "text/xml");
var test = filterXmlDoc.getElementsByTagName("filter")[0];
test.nodeValue; // null!