PC Review


Reply
Thread Tools Rate Thread

Create XmlDocument from subset of another

 
 
John Spiegel
Guest
Posts: n/a
 
      1st Mar 2005
Hi all,

I'm trying to efficiently pull data out of an xml file into a XmlDocument
AND create another "sub" document based on one subtree of the document. For
example, say I've got:

<Books>
<Book>
<Title>Some book</Title>
</Book>
<Book>
<Title>Some other book</Title>
</Book>
<Books>

So far I've tried things like:

XmlDocument doc = new XmlDocument();
doc.LoadXml("Books>" +
"<Book><title>Some book</title></Book>" +
"<Book><title>Some other book</title></Book>"+
"</Books>");

XmlNode nodBook= doc.FirstChild.FirstChild;
XmlDocument docPart = new XmlDocument();
docPart.ImportNode( nodBook, true );


However, docPart only winds up as null. I've tried variations on the
ImportNode theme and received errors relating to the context being wrong for
the node.

Any pointers on create a sub-XmlDocument from an existing XmlDocument?

Thanks,

John


 
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
How to create a List subset of 10 each deefish99 via AccessMonster.com Microsoft Access Queries 3 16th Mar 2007 03:25 PM
Xcl-create subsets of a set of numbers w/o duplicating the subset =?Utf-8?B?QXV0byBIb2xpZGF5IENhbGVuZGFy?= Microsoft Excel Worksheet Functions 0 15th Nov 2006 05:45 PM
How do I create a new worksheet for a subset of data =?Utf-8?B?QmVubmll?= Microsoft Excel Misc 2 20th Jul 2006 11:26 PM
Create XMLDocument on the fly. aaa Microsoft C# .NET 4 17th Feb 2005 02:57 PM
create a subset range in a VBA UDF Jason Microsoft Excel Programming 1 24th Jul 2004 11:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:40 AM.