I'm not sure why this isn't working.
I have an XmlNode in a known-format. It is:
<[setting-name]>
<dictionary>
<[block-of-xml-to-process]/>
<[block-of-xml-to-process]/>
<[block-of-xml-to-process]/>
</dictionary>
</[setting-name]>
I have a reference to the node in a variable called pattern. I want an iterable collection of nodes, each of which is represented by a [block-of-xml-to-process] above. The name and structure of the blocks is unknown at this point. [Setting-name] is known.
This seems pretty straightforward. I can think of a half-dozen XPATH expressions that should point to the blocks. I've tried:
XmlNodeList kvpsList = pattern.SelectNodes(String.Format(@"/{0}/dictionary/*", _CollectionName));
XmlNodeList kvpsList = pattern.SelectNodes(String.Format(@"{0}/dictionary/*", _CollectionName));
XmlNodeList kvpsList = pattern.SelectNodes(@"//dictionary/*");
XmlNodeList kvpsList = pattern.SelectNodes(@"//dictionary");
But, I am apparently lacking some basic understanding of XPATH or some special trick of .SelectNodes because none of them work consistently.
What am I doing wrong?