@@ -197,28 +197,13 @@ DocUtils.clone = (obj) ->
197197 return newInstance
198198
199199DocUtils .xml2Str = (xmlNode ) ->
200- if xmlNode== undefined
201- throw new Error (" xmlNode undefined!" )
202- try
203- if global ?
204- a = new XMLSerializer ()
205- content = a .serializeToString (xmlNode)
206- # Gecko- and Webkit-based browsers (Firefox, Chrome), Opera.
207- else
208- content = (new XMLSerializer ()).serializeToString (xmlNode);
209- catch e
210- content = xmlNode .xml ;
211- content = content .replace / \x20 xmlns=""/ g , ' ' # remove all added xmlns="" (these cause the file to be corrupt and was a problem for firefox)
200+ a = new XMLSerializer ()
201+ content = a .serializeToString (xmlNode)
202+ content .replace / \x20 xmlns=""/ g , ' ' # remove all added xmlns="" (these cause the file to be corrupt and was a problem for firefox)
212203
213204DocUtils .Str2xml = (str ,errorHandler ) ->
214- if DOMParser # Chrome, Firefox, and modern browsers
215- parser = new DOMParser ({errorHandler})
216- xmlDoc = parser .parseFromString (str," text/xml" )
217- else # Internet Explorer
218- xmlDoc = new ActiveXObject (" Microsoft.XMLDOM" )
219- xmlDoc .async = false
220- xmlDoc .loadXML (str)
221- xmlDoc
205+ parser = new DOMParser ({errorHandler})
206+ xmlDoc = parser .parseFromString (str," text/xml" )
222207
223208DocUtils .replaceFirstFrom = (string ,search ,replace ,from ) -> # replace first occurence of search (can be regex) after *from* offset
224209 string .substr (0 ,from )+ string .substr (from ).replace (search,replace)
0 commit comments