mhs mhs

mhs mhs

  • NA
  • 10
  • 19.8k

How to import data from xml file into a dataset

Sep 19 2010 1:07 PM

I want to import data from a xml file into a dataset
this is my xml file

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<Persons>

  <Person Personid="10">

    <firstname>Hi</firstname>

    <lastname>bye</lastname>

    <Birthday>1360 </Birthday>

    <Phones>

      <Fax>04</Fax>

      <Other>05</Other>

      <Home>01</Home>

    </Phones>

    <Emails>

      <Email>[email protected]</Email>

    </Emails>

    <Webs>

      <Web>web.com</Web>

    </Webs>   

  </Person> 

</Persons>

when I use this code
dataset1.readxml(FilePath);
I have these tables in my dataset
Person,Phones,Emails,Webs
But I want to have FIVE (more) tables for Fax,Mobile,House,Email,Web
that ARE connected to "Person" table (Fax,Mobile,House are connected to Phones , Email to Emails AND Web to Webs)

when the xml file is like below it has these tables:

Person,Phones,Emails,Webs,Fax,Mobile,House,Email,Web

{ Emails connects to Email},{ Webs connects to Web } AND { Phones connects to fax,house and mobile }

 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<Persons>

  <Person Personid="10">

    <firstname>hi</firstname>

    <lastname>bye</lastname>

    <Birthday>1980 </Birthday>

    <Phones>

      <Fax>044</Fax>

      <Mobile>055</Mobile>

      <House>011</House>

      <Fax>04</Fax>

      <Mobile>05</Mobile>

      <House>01</House>

    </Phones>

    <Emails>

      <Email>[email protected]</Email>

      <Email>[email protected]</Email>

    </Emails>

    <Webs>

      <Web>web1.com</Web>

      <Web>web2.com</Web>

    </Webs>

  </Person>

</Persons>

I want to always have these tables
is there any way?


Answers (1)