1

I have XML which very complicated in structure, as below. My objective is to get all the data from the XML, dump into database as relational structure. What is the best way to achieve it using c#.

<a> 
   <b>
        <c> 
            <d>
                <e>....
                <e>
                <e>
            </d>
            <d>
            </d>
        </c>
     </b>

   <b>
        <c> 
            <d>
                <e>....
                <e>
                <e>
            </d>
            <d>
            </d>
        </c>
     </b>
</a>
2
  • This is way too broad a question. What have you tried? I suggest you start by looking at sites like this Commented Mar 24, 2012 at 2:57
  • I'm just starting the work, i just want to know the best approach. Commented Mar 24, 2012 at 3:45

1 Answer 1

1

As an exercise create classes for each node type.

Aka

class A
{
public B[] Bs; <- one-to-many
}

class B
{
public C C; <- one-to-one
}

class C
{
public D[] Ds; <- one-to-many
}

etc. With that you can start to see the relationships between classes and what goes into each class. Each class is potentially a table in the relational database. Since class A is really the root node, it probably isn't a table, but there for completeness.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.