MCPcopy Index your code
hub / github.com/SuperMap/iClient-JavaScript / parseXML

Function parseXML

libs/echarts/echarts.simple.js:26379–26395  ·  view source on GitHub ↗

* For big svg string, this method might be time consuming. * * @param {string} svg xml string * @return {Object} xml root.

(svg)

Source from the content-addressed store, hash-verified

26377 * @return {Object} xml root.
26378 */
26379function parseXML(svg) {
26380 if (isString(svg)) {
26381 var parser = new DOMParser();
26382 svg = parser.parseFromString(svg, 'text/xml');
26383 }
26384
26385 // Document node. If using $.get, doc node may be input.
26386 if (svg.nodeType === 9) {
26387 svg = svg.firstChild;
26388 }
26389 // nodeName of <!DOCTYPE svg> is also 'svg'.
26390 while (svg.nodeName.toLowerCase() !== 'svg' || svg.nodeType !== 1) {
26391 svg = svg.nextSibling;
26392 }
26393
26394 return svg;
26395}
26396
26397function SVGParser() {
26398 this._defs = {};

Callers 1

echarts.simple.jsFile · 0.70

Calls 1

isStringFunction · 0.70

Tested by

no test coverage detected