PC Review


Reply
Thread Tools Rate Thread

Add Parent level to XML with Linq

 
 
Avi
Guest
Posts: n/a
 
      24th Jun 2008
Hi all,



I'm using Linq and would like to encapsulate my xml with an additional
parent level.



My XML

<Collection>

<ChildCollection>

</ChildCollection>

</Collection>



The XML I want with an additional parent level



<CollectionParent>

<Collection>

<ChildCollection>

</ChildCollection>

</Collection>

</CollectionParent>



What is the command to do that?



Thanks,

Avi


 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      24th Jun 2008
Avi wrote:

> What is the command to do that?


Simply create a new XElement and pass the other in e.g.

XElement col = XElement.Parse(@"<Collection>

<ChildCollection>

</ChildCollection>

</Collection>");
XElement colPar = new XElement("CollectionParent", col);




--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
 
Reply With Quote
 
Avi
Guest
Posts: n/a
 
      24th Jun 2008
Thanks,

"Martin Honnen" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Avi wrote:
>
>> What is the command to do that?

>
> Simply create a new XElement and pass the other in e.g.
>
> XElement col = XElement.Parse(@"<Collection>
>
> <ChildCollection>
>
> </ChildCollection>
>
> </Collection>");
> XElement colPar = new XElement("CollectionParent", col);
>
>
>
>
> --
>
> Martin Honnen --- MVP XML
> http://JavaScript.FAQTs.com/



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LINQ XML Determine Parent Node SPS101 Microsoft C# .NET 3 16th Dec 2009 03:04 AM
unread email indicator at parent folder level (take 2) swilson317 Microsoft Outlook Discussion 0 11th Mar 2009 03:49 AM
Linq, isolation level imbirek8 Microsoft C# .NET 0 2nd Oct 2008 07:39 PM
LINQ - Concatenated seq from subcollection under parent collection Todd Beaulieu Microsoft Dot NET 3 5th Mar 2008 12:09 AM
linq xml nexted node parent Guzeppi Microsoft C# .NET 0 16th Jan 2008 08:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:57 AM.