I'm having some sample xml data from the server. And i parsed xml and converted into Java Modal objects to be used according to my requirement.
But i stucked here!!!
I need to store the xml data into the Sqlite
So please can you suggest the structure that how store the xml content in the form of Tables .
Xml Sample format
<result>
<title>Some Title</title>
<b_data>
<!First B Data>
<b>
<total>10</total>
<c_data>
<!First C Data>
<c>
<name>Name1</name>
<value>15</value>
</c>
<!Second C Data>
<c>
<name>Name2</name>
<value>15</value>
</c>
</c_data>
</b>
<!Second B Data>
<b>
<total>10</total>
<c_data>
<c>
<name>Name1</name>
<value>15</value>
</c>
<c>
<name>Name2</name>
<value>15</value>
</c>
</c_data>
</b>
</b_data>
</result>
Java Classes
public class A {
public String title;
public ArrayList<B> bObjects;
}
public class B {
public String total;
public ArrayList<C> cObjects;
}
public class C {
public String name;
public String value;
}
You can have three tables A,B,C for each entity with field for each property.
For each one-to-many relationship you can have id field.
In your case it will be
B_Id in C table
A_Id in B table
They will indicate item's parent.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.