非空#text节点的XPath(tDOM) [英] XPath for non-empty #text nodes (tDOM)
问题描述
您好!
查询的语法是什么,这将允许我只获得非空的
元素文本节点?
例如,来自:
< a>< b>< / b>< / a> ;
< c />
< d>< e> meow< / e>< / d>
我只想得到d / e ......如果这很重要,我正在使用Tcl和tDOM
扩展名。谢谢!
-mi
Hello!
What''s would be the syntax for a query, which would allow me to get only the
elements with non-empty text-nodes?
For example, from:
<a><b></b></a>
<c/>
<d><e>meow</e></d>
I only want to get the d/e ... If this matters, I''m using Tcl with the tDOM
extension. Thanks!
-mi
推荐答案
文章< 44 **** **************************@speakeasy.net> ,
Mikhail Teterin< us ********* @ aldan.algebra.comwrote:
In article <44******************************@speakeasy.net> ,
Mikhail Teterin <us*********@aldan.algebra.comwrote:
>什么'这将是一个查询的语法,这将允许我只获得具有非空文本节点的
元素?
>What''s would be the syntax for a query, which would allow me to get only the
elements with non-empty text-nodes?
大概是指直接文本的孩子(而不是后代),
和非空。你的意思是包含除空白之外的东西。
如果是这样,试试
* [normalize-space(text())! =""]
(或者在开始时使用//,具体取决于具体情况)。
- Richard
-
:wq
Presumably you mean direct text children (rather than descendants),
and by "non-empty" you mean "containing something other than whitespace".
If so, try
*[normalize-space(text()) != ""]
(or with // at the start, depending on the context).
-- Richard
--
:wq
Richard Tobin写道:
Richard Tobin wrote:
大概你的意思是直接文字儿童(而不是后代),
和非空。你的意思是包含除空格之外的其他东西。
如果是这样,试试
* [normalize-space(text())? *!=?*""]
(或者在开头时使用//,具体取决于上下文)。
Presumably you mean direct text children (rather than descendants),
and by "non-empty" you mean "containing something other than whitespace".
If so, try
*[normalize-space(text())?*!=?*""]
(or with // at the start, depending on the context).
是的,无论信不信,这都有效。非常感谢您快速回复
!
你的,
-mi
Yep, that worked, believe it or not. Thank you very much for the quick
response!
Yours,
-mi
你好!
我需要找到名为mp:date的所有节点。出于某种原因,
Hello!
I need to locate all nodes named "mp:date". For some reason, the
这篇关于非空#text节点的XPath(tDOM)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!