I\'m new to jQuery and would like to parse an XML document.
I\'m able to parse regular XML with the default namespaces but with XML such as:
just replaced the namespace by empty string. Works fine for me. Tested solution across browsers: Firefox, IE, Chrome
My task was to read and parse an EXCEL-file via Sharepoint EXCEL REST API. The XML-response contains tags with "x:" namespace.
I decided to replace the namespace in the XML by an empty string. Works this way: 1. Get the node of interest out of the XML-response 2. Convert the selected node XML-Response (Document) to String 2. Replace namespace by empty string 3. Convert string back to XML-Document
See code outline here -->
function processXMLResponse)(xData)
{
var xml = TOOLS.convertXMLToString("", "",$(xData).find("entry content")[0]);
xml = xml.replace(/x:/g, ""); // replace all occurences of namespace
xData = TOOLS.createXMLDocument(xml); // convert string back to XML
}
For XML-to-String conversion find a solution here: http://www.sencha.com/forum/showthread.php?34553-Convert-DOM-XML-Document-to-string