Click here to Skip to main content
15,885,899 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
JavaScript
if (window.DOMParser) {
 var parser = new DOMParser();
 {
   doc = parser.parseFromString(string, "text/xml");
 }
return doc;
}

doc is returning null when i am trying to convert it into xml in chrome
Posted
Updated 13-Jun-13 2:28am
v2
Comments
pianca 13-Jun-13 8:54am    
it is not working still the same issue exists the body(content) is null

Have a look on following thread:
Parse String to XML[^]

..and a similar QA here[^]
 
Share this answer
 
v2
Comments
pianca 15-Jun-13 5:25am    
The Same thing i have tried it its not working
Try this:
C#
if (window.DOMParser) {
   var parser = new DOMParser();
   var doc = parser.parseFromString(stringContainingXMLSource, "application/xml");
   return doc;
}

Refer : Creating a DOMParser[^].


--Amit
 
Share this answer
 
Comments
pianca 13-Jun-13 8:44am    
var parser = new DOMParser();
var doc = parser.parseFromString(stringContainingXMLSource, "application/xml");

this i have tried it but it has not worked
_Amy 13-Jun-13 8:45am    
Did you tried the steps in link?
pianca 13-Jun-13 10:16am    
var doc = parser.parseFromString(string, "application/xml").documentElement; iam getting all the child nodes but the body iam getting is null
_Amy 14-Jun-13 0:02am    
Check your string in string. Rename the variable and verify it's content. It'll work.
pianca 15-Jun-13 5:24am    
I have tried it its not working

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900