Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to add XML Parser to manipulate xml in spidermonkey

93 views
Skip to first unread message

msami

unread,
Aug 28, 2019, 10:23:35 AM8/28/19
to
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;

Ted Campbell

unread,
Aug 29, 2019, 1:25:43 PM8/29/19
to
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.
0 new messages