How to get tag parameter value with XQuery
Posted
by uni
on Stack Overflow
See other posts from Stack Overflow
or by uni
Published on 2010-03-19T10:58:10Z
Indexed on
2010/03/19
11:01 UTC
Read the original article
Hit count: 169
For example i have this xml. I need to get value of parameter val
of tag foo
with id="two"
<top>
<sub id="one">
<foo id="two" val="bar" />
sometext
</sub>
</top>
Whis this query (using Qt QXmlQuery):
doc('test.xml')/top/sub[@id='one']/foo[@id='two']/<p>{@val}</p>
I receive <p val="bar"/>
, but I need only text "bar" without any tags.
I tried to remove <p>
and </p>
and receive syntax error, unexpected {
How can i get parameter value without any tags?
© Stack Overflow or respective owner