I have some xml (in a file, but can be a string) which I need to parse, e.g.:
var xmlDocument = new XmlDocument();
xmlDocument.LoadXml(xmlText);
Given the following XML:
<foo>
    <cat>...</cat>
    <cat>...</cat>
    <dog>...</dog>
    <cat>...</cat>
    <dog>...</dog>
</foo>
I'm not sure how I can extract all the cat and dog elements and put them into the following output :-
<foo>
    <cat>...</cat>
    <cat>...</cat>
    ....
</foo>
and the same with dogs.
What's the trick to extract those nodes and put them into separate XMLDocuments.
 
     
     
     
     
    