I really believe it's possible to do what I want with a SelectNodes() XPath
query, but I'm lost. Any help would be appreciated. Suppose you have an
XML document (like a WordProcessingML file) that has a bunch of elements
embedded in it that conform to a schema, but each schema-defined
parent/child relationship can have (an arbitrary number of) intervening
elements from another namespace. I'm trying to do something simple, find
all "children" (considering only my namespace) of a particular node. For
example suppose you have something like:
<w:wordDocument xmlns:w="http://theirs" xmlns:ns1="http://mine" >
....
<w:body>
<wx:sect>
<ns1:ReportData>
<w:pPr>
<w:jc w:val="center" />
</w:pPr>
<w:p />
<ns1:Solution>
<w:p />
<ns1:Requirements/>
<w:p />
</ns1:Solution>
<w:p />
<ns1:Path/>
</ns1:ReportData>
</wx:sect>
</w:body>
</w:wordDocument>
Suppose I have an XmlElement corresponding to the <ns1:ReportData> element.
I know I can get all ns1: descendants using SelectNodes("//ns1:*", ...).
But how in the world can I qualify this so that I only get the "child" (sort
of) descendants (within my namespace) which are <ns1:Solution> and
<ns1:Path> but not nodes that are under one of those, like
<ns1:Requirements>.
Thanks for your help with this puzzler.
Tom Clement
Apptero, Inc.