vinay.sindri Posted January 25, 2008 Share Posted January 25, 2008 Hi!I am reading an XML response in Mozilla. The response XML is like below:<?xml version="1.0" encoding="ISO-8859-1" ?> <Categories> <Category> <CategoryId>4</CategoryId> <CategoryName>Consultant</CategoryName> <DepartmentId>11</DepartmentId> </Category> <Category> <CategoryId>3</CategoryId> <CategoryName>MST Program Development</CategoryName> <DepartmentId>11</DepartmentId> </Category> <Category> <CategoryId>2</CategoryId> <CategoryName>MSTnet Testing</CategoryName> <DepartmentId>11</DepartmentId> </Category> <Category> <CategoryId>1</CategoryId> <CategoryName>Videotape Training Project</CategoryName> <DepartmentId>11</DepartmentId> </Category> </Categories>I am trying follwoing code:xmlHttp.responseXML.documentElement.childNodes[i-1].childNodes[1].text;But in Mozilla, it is saying undefined. Whereas, it is coming in IE.Please help... Link to comment Share on other sites More sharing options...
Ingolme Posted January 25, 2008 Share Posted January 25, 2008 The text property is an Internet-Explorer-only thing.The W3C standard is textContent but that only works in Firefox.You should be able to access the text node by writing this:xmlHttp.responseXML.documentElement.childNodes[i-1].childNodes[1].firstChild.nodeValue; Link to comment Share on other sites More sharing options...
jeffman Posted January 25, 2008 Share Posted January 25, 2008 Bless you, Ingolme, for not suggesting he use the equally non-compliant (and yet ubiquitous) innerHTML property. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.