Gimme everything you got slashes

Today I discovered a new bug. No, not the insect kind. It was a programming error. To be more specific, one that only showed up after fixing another one. Somehow using ‘//whatever’ as an XPath query on any node in a Document will give you all the nodes that match from the Document root. That’s because you said ‘//’, it means ‘I-don’t-know-where-it-is-but-I-want-it’.

Normally I would invoke it on the root of a XML document, so no problem there. But processing a collection of parts in a collection of parts will cause some problems. If you already know about the structure , then there is no need for the gimme-everything-you-got slashes!

Advertisements