and then querying it.
You want sort of a grep that 's  that works at the structural  on the structural representation.
OK.
You have that. There 's a  standard again in XML , specifically for searching XML documents  structured X - XML documents , where you can specify both the content and the structural position.