• Post Reply Bookmark Topic Watch Topic
  • New Topic

node()  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
<abc att1="xyz"/>
What will the test evaluate to if the following expression is applied on the above element?
<if test="node()"> </if>
XML@Whiz says about this: The test condition will evaluate to false as the element <abc> has no children or text element as its children, that's why its not a node, having attribute doesn't qualify an element as a node.
Is this correct? Can't find any source for good explanaition. Thanks for a hint...
Regards
Berny
 
Hema Menon
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
node() test selects all nodes in the current context, regardless of the type. This includes elements, text, comments, processing instructions, attributes and namespace nodes. I guess hence it would be incorrect to say the test result is false.
Later,
Hema
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!