Re: How to add XML Parser to manipulate xml in spidermonkey
Ted Campbell <[email protected]> Thu, 29 Aug 2019 10:25:42 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <[email protected]> |
On Wednesday, August 28, 2019 at 10:23:35 AM UTC-4, msami wrote:
> How to add XML Parser to manipulate xml in spidermonkey
>
> I want to parse xml like this:
> <?xml version="1.0" encoding="UTF-8"?>
> <quote xmlns="http://www.example.org">
> <ticker>F</ticker>
> <name>Ford Motor Company</name>
> <change>1.00</change>
> <last>30.00</last>
> </quote>
>
>
> and handle it like document object in a browser as following
>
> var price= quote.documentElement.getElementsByTagNameNS("http://www.example.org", "last").item(0).firstChild.data;
SpiderMonkey itself does not implement either the DOM or an XML parser. An option to consider for your example would be to use a javascript library that emulates the DOM such as https://github.com/jsdom/jsdom. You should be able to run that within SpiderMonkey with the rest of your JS code.