Hi,
I would like to keep few the node's in my xml based on another
XML.
string rootXml = @"<Results>
<Result>
<Name>John</Name>
<Phone>110</Phone>
<Location>USA</Location>
</Result>
<Result>
<Name>Mary</Name>
<Phone>120</Phone>
<Location>UK</Location>
</Result>
</Results>";
// Nodes to keep
string filterXML =
@"<NodesToKeep>
<Node value="Name">
<Node
value="Phone">
</NodesToKeep>";
Now using XElement and Linq to
XML I want to remove all Location nodes from my rootXML. Both rootXML and
filterXML will vary by request.
What I have been trying to do
is:
var retVars = from c in rootXml.Elements(elementName)
orderby {Dynamic list
of columns}
select ({Dynamic List of all filter columns from filterXML);
and at last I want to serialze the retVars.
Please let me know how can I build the list of columns to be
selected during runtime.
Thanks
Punu