'Adds tag and index to the path; they will be popped off when
the corresponding \'with\' statement exits.
:param tag: The element tag
:param idx: If not None, the integer index of the element
within its parent.  Not included in the path
element if None.'

def node(self, tag, idx):

    if (idx is not None):
        self.path.append(('%s[%d]' % (tag, idx)))
    else:
        self.path.append(tag)
    return self
