Click here to Skip to main content
12,760,992 members (30,739 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# XML WPF
<MainParents>
      <Parent>
        <Child 1>Something</Child 1>
        <Child 2>Something</Child 2>
        <Child 3>Something</Child 3>
        <Child 4>Something</Child 4>
      </Parent>
</MainParents>

----------------------------------
i would like to remove only the "Parent" tag not its content tags in this XML can you any body help me ...
finally i need output like . . .
<MainParents>
    <Child 1>Something</Child 1>
    <Child 2>Something</Child 2>
    <Child 3>Something</Child 3>
    <Child 4>Something</Child 4>
 </MainParents>
Posted 25-Jun-12 0:40am
Updated 25-Jun-12 0:41am
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

you can try like this..

1) read the <parent> tag and copy all child node using inner xml
2) now go to the root node that is MainParents
3) now replace the inner xml string with your xml string which is read in first step.

i think it will solve your problem.

but i can't under stand why you need this. you can directly access the child node by steping on the Parent tag.
  Permalink  
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 25 Jun 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100