Click here to Skip to main content
16,012,223 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<Bookmark>
  <Title Action="GoTo" >
    1. Cacor Corporation
    <Title  Action="GoTo" >1.1. Direct Sighting Compass</Title>
    <Title  Action="GoTo" >1.2. Dive Computer</Title>
    <Title  Action="GoTo" >1.3. Navigation Compass</Title>
    <Title  Action="GoTo" >1.4. Wrist Band Thermometer (F)</Title>
    <Title Action="GoTo" >1.5. Depth/Pressure Gauge (Digital)</Title>
    <Title Action="GoTo" >1.6. Depth/Pressure Gauge (Analog)</Title>
    <Title  Action="GoTo" >1.7. Wrist Band Thermometer (C)</Title>
  </Title>
  <Title  Action="GoTo" >2. Underwater</Title>
  <Title Action="GoTo" >
    3. J.W.  Luscher Mfg.
    <Title  Action="GoTo" >3.1. Remotely Operated Video System</Title>
    <Title  Action="GoTo" >3.2. Boat Towable Metal Detector</Title>
    <Title  Action="GoTo" >3.3. Boat Towable Metal Detector</Title>
    <Title  Action="GoTo" >3.4. Underwater Altimeter</Title>
    <Title  Action="GoTo" >3.5. Sonar System</Title>
    <Title  Action="GoTo" >3.6. Marine Magnetometer</Title>
    <Title  Action="GoTo" >3.7. Underwater Metal Detector</Title>
    <Title  Action="GoTo" >3.8. Underwater Metal Detector</Title>
  </Title>
Posted
Updated 25-Jul-17 23:43pm
v2
Comments
Mehdi Gholam 24-Sep-12 8:02am    
What happens when you do read it into a dataset?
myfusion 24-Sep-12 8:07am    
below exception error occur when read into dataset

cannot add a nested relation or an element column to a table containing a simple content column
I.explore.code 24-Sep-12 8:17am    
is it due to the fact that you've got Title as a parent tag and Title as sub-tags as well? Try renaming the parent tags, for e.g. "ParentTitle"...
myfusion 24-Sep-12 8:19am    
any other solution...
this xml is generating dynamically so i dnt know how much nesting will be there

This works:
C#
[Serializable]
public class Bookmark
{
    [XmlElement(ElementName="Title")]
    public List<Title> TitleCollection { get; set; }
}

[Serializable]
public class Title
{
    [XmlAttribute]
    public string Action { get; set; }
    [XmlText]
    public string Value { get; set; }
    [XmlElement("Title")]
    public List<Title> TitleSubCollection { get; set; }
}


Edit: Tested serializing and deserializing your xml, and it worked. Hope this in turn will help you to load it into a DataSet.
 
Share this answer
 
v3
Hi,
u can also try

ds.ReadXMl("xml fill path/file name") and ds.writeXml("xml fill path/file name") ;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900