View Full Version : Ext.DomQuery doesn't work with a certain query

13 Apr 2012, 1:02 AM
Hi there,
I've got some problems to query an xml document with Ext.DomQuery class.
The query is: '//el[not(subel)]'

And this is the XML:

<?xml version="1.0"?>
<el id="1">
<el id="2">
<subel href="1"/>
<el id="3">
<subel href="2"/>

And that's the code:

Ext.Ajax.request ({
url: 'http://localhost/doc.xml' ,
success: function (res) {
var xml = res.responseXML;
var dq = Ext.DomQuery;
var el = dq.select ('//el[not(subel)]', xml);
// Here we got an infinite loop ...

As you can see, the execution goes in an infinite loop but the result should be like this:

<el id="1">

I tried with a simple xpath processor, giving the same query and file, and it works!

Maybe Ext.DomQuery.select() expects a different query with the same mean?

Thanks in advance.


13 Apr 2012, 4:07 AM
Ok, I found the solution by myself.
This is the right query: dq.select ('el:not(el:has(subel))', xml);

It selects those elements that does not match with those that have subel as a descendant.