xml - How to get node value / innerHTML with xpath? -


well have xpath dig class want: //div[@class='myclass']. returns me whole div (with < div class='myclass'> , return contents of tag without tag . how can it?

with xpath, thing returned last thing in path not condition. means? well, conditions stuff between []'s (but knew that) , yours reads pathelement[that has 'class' attribute value 'my class']. pathelement comes directly before [.

all stuff outside of []'s path, in //a/b/c[@blah='bleh']/d a, b, c , d path elements, blah attribute , bleh literal value. if path matches return d, last non-condition thing.

your particular path returns (series of) div, being last thing in xpath's path. return value includes top-level node(s), div in case, , underneath (them) (their) children. nodes can elements or text (or comments, processing instructions, ...).

underneath node there can multiple text nodes, hence array pocha talks about. x/text() returns text direct child of x, x/node() returns child nodes, including text.

hope helps.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -