Click here to Skip to main content
Rate this: bad
good
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 24-Jun-12 23:40pm
Edited 24-Jun-12 23:41pm
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 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
0 CPallini 350
1 Sergey Alexandrovich Kryukov 320
2 BillWoodruff 309
3 George Jonsson 274
4 OriginalGriff 237
0 OriginalGriff 4,903
1 CPallini 3,960
2 Sergey Alexandrovich Kryukov 3,474
3 George Jonsson 2,786
4 Gihan Liyanage 2,386


Advertise | Privacy | Mobile
Web01 | 2.8.140905.1 | Last Updated 25 Jun 2012
Copyright © CodeProject, 1999-2014
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