[xmljs-users] Dom object
Brought to you by:
djoham,
witchhunter
|
From: Fredrik B. d <fr...@bj...> - 2016-05-08 20:48:36
|
Hi,
thanks for the workonXML for <SCRIPT>
I've been trying to use it in c# using Jint and Jurassic, and has encountered a problem using both tools.
I load the libraries into the Javascript engines, create a parser
var domParser = new DOMImplementation();
Then I use the parser to load the following xml into a variable, var1
<books xmlns="">
<book title="title1" />
<book title="title2" />
</books>
This works well. Next I try to execute the following query:
var1.getElementsByTagName('book')[0].getAttribute('title'), expecting that it will yield 'title1'. There is however an error.
If I do var1.getElementsByTagName('book'), then I get:
<book title="title1" />
<book title="title2" />
But if I add the indexer, var1.getElementsByTagName('book')[0], then I get undefined in response
I would like to get this to work, and XML for <script> seemed promising. I get the same behaviour in jint and jurassic leading me to think that it may be an issue with XML for <script>.
Do you have any ideas on how to proceeed? Do you have any alternative ideas on how to execute a query like this in javascript using c#.
Thanks,
Jon
|