开发者

In XPath how to select the element content

Is there a way of writing an XPath expression to select the conten开发者_运维知识库t of the element.

e.g.

<Element>xxx</Element>

Assuming I can write XPath (/Element) to get Element how do I tweak the XPath to get xxxx returned rather than the Element wrapper?

EDIT/ANSWER

To do this in dom4j world use the Element.valueOf(String xpathExpression) rather than the .selectXXX() methods.


Use the value-of element:

<xsl:value-of select="/Some/Path/To/Element"/>

If you can only specify an XPath then use the text function like this:

/Some/Path/To/Element/text()


A bit too late but...

data(Element)

...should also be fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜