Jump to content

XML in Mozilla


vinay.sindri
 Share

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...