Jump to content

XML in Mozilla


vinay.sindri

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...