user393148
user393148

Reputation: 957

Reading XML into Dataset with correct schema

I have some xml like this.

<RootTop>

<FileTablets>
<Tablet Name="">
</Tablet>
</FileTablets>

<DirectoryTablets>
  <Directory FullPath="Path1" Id="" />    
<Directory FullPath="Path2" Id="" />
     <SubPath Path="Path Id="" />
     <SubPath Path="Path Id="" />
     <SubPath Path="Path Id="" />
  </Directory>
</DirectoryTablets>
</RootTop>

When I user dataset.readxml() with inferring schema or read schema, data gets read into the data set but not in the format I want. I want only the information under DirectoryTablets Sub tree. How can I read the data directly into dataset in the format I want Here is the format I want: Table name: DirectoryTablets

FullPath Id SubPath-Path SubPath-Id (Empty if subpath nodes don’t exist)

FullPath Id SubPath-Path SubPath-Id

Upvotes: 0

Views: 513

Answers (1)

John Saunders
John Saunders

Reputation: 161773

The DataSet class is an in-memory representation of a relational data model.

Not all XML maps to a relational data model.

This means that some XML can't be read into a DataSet.

This includes the XML you posted.

Choose a different mechanism for processing the XML.

Upvotes: 1

Related Questions