Reputation: 9
I have this XML file:
var k= <texta xmlns="http://www.ert.com" xmlns:ns="http://asd/asi/" xmlns:xsd="http://dgewdged" xmlns:SOAP-ENV="http://sasdfasdf" xmlns:xsi="http://asdfasdgsde">
<textb>
<textc>Test</textc>
</textb>
</texta>
how can i get with E4X only the text "Test"?
var text=k.textb;
Alert(text);
I tried it on this way...but i get:
<textb xmlns="http://www.ert.com" xmlns:ns="http://asd/asi/" xmlns:xsd="http://dgewdged" xmlns:SOAP-ENV="http://sasdfasdf" xmlns:xsi="http://asdfasdgsde">
<textc>Test</textc>
</textb>
How can i remove the whole Namespaces ?
thank you for your help.
Upvotes: 0
Views: 441
Reputation: 1729
There are several ways to access those elements.
default xml namespace = 'http://www.ert.com';
var text = k.textb.textc.toString();
Alert(text);
// reset to empty namespace
default xml namespace = '';
var ert = new Namespace('http://www.ert.com');
var text = k.ert::textb.ert::textc.toString();
Alert(text);
var text = k.*::textb.*::textc.toString();
Alert(text);
Upvotes: 1