Q:

XPath expression meaning

I'm new to XPath and want you to consider the following expression, where n is an element:
//n[parent::n and child::n]
Does the expression in  [ ] mean that the parent and child node of n must be the same? 
Or am I totally wrong? Thank you.

A:

Does the expression in [ ] mean that the parent and child node of n must be the same? 

The correctness of your statement depends on what you mean by "the same". If by "the same", you mean "identical", then the statement is clearly incorrect. A node cannot be the parent and child of something at the same time.
On the other hand, if you intended to write "having the same name", then it's true. The expression
//n[parent::n and child::n]

means

Look for all elements with the name n, everywhere in the document, but only if their parent element is also called n and if they have at least one child element called n.

