[英]How to store xml data into sqlite database
I have a xml format data which is came from server. 我有一个来自服务器的xml格式数据。 Now i want to store it into database and it should load on button click.
现在我想将其存储到数据库中,并应在单击按钮时加载。 How should i do this?
我应该怎么做?
enter code here
<qst_code> 7 </qst_code>
<qst_prg_code> 1 </qst_prg_code>
<qst_mod_code> 2 </qst_mod_code>
<qst_Question>What is not true about left dominant cardiology circulation? </qst_Question>
<qst_opt1>It is seen in 20% of the population</qst_opt1>
<qst_opt2>Left circumflex artery supplies the Posterior descending artery</qst_opt2>
<qst_opt3>Left circumflex artery terminates as obtuse marginal branch</qst_opt3>
<qst_opt4>Left circumflex artery may originate from right coronary sinus</qst_opt4>
<qst_opt01>1</qst_opt01>
<qst_opt02>1</qst_opt02>
<qst_opt03>1</qst_opt03>
<qst_opt04>1</qst_opt04>
<qst_CorctOpt>1</qst_CorctOpt>
<qst_Marks>10</qst_Marks>
<qst_company_code>1</qst_company_code>
<user_code>1</user_code>
一种选择是,如果数据不是太大,则将其存储为字符串,否则将其分解为映射到sqlite的架构,并在加载时重新创建它。
If your XML data is large, I would rather change the data exchange type to json. 如果您的XML数据很大,我宁愿将数据交换类型更改为json。 XML parsing and then insert is a very expensive operation and is time-consuming.
XML解析然后插入是非常昂贵的操作,并且很耗时。
Some issues which you will face with XML parsing and insert. XML解析和插入将面临一些问题。
a. 一种。 XML parsing is memory intensive and so you heap size will grow, you need to keep an eye on this as this might cause crash.
XML解析占用大量内存,因此您的堆大小将会增加,因此需要注意这一点,因为这可能会导致崩溃。 b.
b。 Inserts in SQLite DB will take around ~100ms per tuple (row), so you can calculate the time it will required to pump in thousands of rows of data.
每行(行)在SQLite DB中插入大约需要100毫秒,因此您可以计算抽入数千行数据所需的时间。
If you data is not too large don't bother about using SQLite. 如果您的数据不是太大,请不要担心使用SQLite。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.