Grupos de Google ya no admite publicaciones ni suscripciones nuevas de Usenet. El contenido anterior sigue visible.

referring to the "context node" in XML filtering predicate with E4X

18 vistas
Ir al primer mensaje no leído

Martin Honnen

no leída,
1 abr 2005, 12:03:05 p.m.1/4/2005
para

E4X section 11.2.4 describes the XML filtering predicate operator. In
the predicate I would like to call a method of the XML object the
filtering predicate is applied to e.g.
xmlObject..*.(nodeKind() == 'text')
however both Rhino and Spidermonkey then tell me that nodeKind is not
defined. Is there any way to call a method in the predicate or is the
predicate only able to access non function properties (i.e. the child
elements by name or the attributes by @attributename)?


--

Martin Honnen
http://JavaScript.FAQTs.com/

Brendan Eich

no leída,
2 abr 2005, 1:44:13 a.m.2/4/2005
para Martin...@gmx.de


E4X has what I call a bug where method names are hidden from the normal
property lookup mechanism, even though the spec says they're
function-valued properties of XML.prototype and XMLList.prototype. We
are talking about fixing this with a function namespace.

I've prototyped this in SpiderMonkey such that (with a fix just checked
in today) the following works:

$ cat fn.js

xmlObject = <a><b>hi</b><b>there</b></a>

l = xmlObject..*.(function::nodeKind() == 'text' &&
print(function::toXMLString()))

$ Linux_All_DBG.OBJ/js -x fn.js
hi
there

The function reserved identifier, when used as a namespace prefix,
identifies an internal namespace whose URI is guaranteed not to collide
with any valid URI. This namespace allows qualified access to function
valued properties of XML.prototype (i.e., methods).

/be

0 mensajes nuevos