Given below is some HTML code corresponding to a div in a web page–
<div id="1">
Text #1
<p> Text #2 </p>
Text #3
</div>
What I am confused about is, do I treat “Text #1” as the first child node, and “Text #3” as the 3rd child node, within the div with id=1? Because “Text #1” and “Text #2” are not enclosed within any HTML construct, while “Text #2” is enclosed within a “p” construct.
What will be the Xquery expression that retrieves the text “Text #3” from the expression above?
Apply the
descendant::text()step to retrieve all text nodes and choose the third node: