On Wednesday, August 29, 2012 3:09:11 PM UTC+2, Malintha wrote:
> var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
> .createInstance(Components.interfaces.nsIDOMParser);
> var doc =
> parser.parseFromString("<test><TestSuite>swg</TestSuite></test>",
> "application/xml");
> alert(doc.getElementByTagName("TestSuite").item(0));
> //I thing i should have the alert "swg" :( but get nothing
> --------------------------------------------------------------------------- --------------------------------------------------------------------
> now this is my code. But still I get nothing. Is there any problem in the
> method when I m creating a DOM parser. Shall have to initialize it after
> creating.
> On Wednesday, August 29, 2012 6:17:01 PM UTC+5:30, Malintha wrote:
>> Hi,
>> I want to read a XML file which has data for my extension. I want to read
>> that file inside the extension and put data to an array. I tried to create
>> DOM object parser and read from that object in my extension .But is not
>> working properly, Here is part of my code
>> var systemPrincipal = Components.classes["@mozilla.org/systemprincipal;1
>> "]
>> .createInstance(Components.interfaces.nsIPrincipal);
>> var parser = Components.classes["@mozilla.org/xmlextras/domparser;1"]
>> .createInstance(Components.interfaces.nsIDOMParser);
>> var doc = parser.parseFromString("<?xml version=1.0
>> encoding=ISO-8859-1?><TestSuite xmlns:xsi=
>> http://www.w3.org/2001/XMLSchema-instancexsi:noNamespaceSchemaLocatio...><TestCase name=logintoChorus><LoadPage>LoginPage<LoadPage/>
>> </TestCase></TestSuite>", "application/xml");
>> alert(doc); //*this gives me the xmldoc object*
>> alert(doc.getElementByTagName("LoadPage")); //*this gives me nothing*
>> I am new to DOM object also ? Can you give me any advice
>> Thanks