Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6705237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:22:50+00:00 2026-05-26T07:22:50+00:00

I need to load XML data into two separate datasets based on a given

  • 0

I need to load XML data into two separate datasets based on a given parameter within the XML. The data is fed back to me via a SOAP call.

Here is a very simplified XML sample:

<![CDATA[<?xml version="1.0" encoding="utf-16"?>

<ArrayOfUser xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<User>
    <ID>111-111-111</ID
    <Name>John Smith</Name>
    <Active>0</Active>
</User>

<User>
    <ID>111-111-222</ID
    <Name>Bob Smith</Name>
    <Active>0</Active>
</User>

<User>
    <ID>111-111-333</ID
    <Name>Sally Smith</Name>
    <Active>1</Active>
</User>


</ArrayOfUser>]]>

Right now, I load everything into a single dataset as such:

XmlDocument UsersXmlDoc= new XmlDocument();
UsersXmlDoc.LoadXml(GetUsersResponse.Fetch_Result);
XmlReader UsersXmlReader= new XmlNodeReader(UsersXmlDoc);

DataSet ds = new DataSet();
ds.ReadXml(UsersXmlReader);

I would like instead to split that information into two datasets based on the Active property of each user so that one dataset contains active uses and the other, innactive users.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:22:50+00:00Added an answer on May 26, 2026 at 7:22 am

    I made an example how you could do what you want. Maybe code isn’t very nice, but I think it should work. The main idea is to copy current dataset and remove active records from first and inactive records from second dataset.

    DataSet dsActive = new DataSet();
    dsActive.ReadXml(UsersXmlReader);
    
    DataSet dsInactive = ds.Copy();//Copy to your another dataset
    Remove(dsActive.Tables[0], "0");//Remove all inactive(where Active = 0) records from dsActive DataSet
    Remove(dsInactive.Tables[0], "1");//Remove all active(where Active = 1) records from dsInactive DataSet
    
    private void Remove(DataTable table, string active)
    {
        for (int i = 0; i < table.Rows.Count; i++)
        {
            if (table.Rows[i]["Active"].Equals(active))
            {
                table.Rows[i].Delete();
                i = i - 1;//Removed record so we need to check same index
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to load a .xml file from a URL adress into an NSData
I have an XML file containing seed data that I'm trying to load into
Need to load data from a single file with a 100,000+ records into multiple
I need to load an XML file and convert the contents into an object-oriented
I need to load an XML source using Simple XML, duplicate an existing node
For a new project I need to load big XML files (200MB+) to a
Question Updated for Bounty In Flash I need to load a dynamically generated XML
I need to modify a (xml-)file from Apache Ant. loadfile task allows to load
I need to load a file from an umounted TrueCrypt disk into memory. Is
I am loading some XML data, building it into an unordered list and displaying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.