简体   繁体   English

Android:如何将数据库文件从xml格式导入sqlite数据库?

[英]Android : How to import a database file from xml format into sqlite database?

I'm trying to import an xml file into sqlite database. 我正在尝试将xml文件导入sqlite数据库。 Actually i have base64 encoded the file and exported to internal storage. 实际上,我已经将base64编码为文件并导出到内部存储。 now, i have no problem with decoding the file but what i need is to replace the existing database file in sqlite with the decoded xml file containing the database in xml format.How to achieve this? 现在,我对文件进行解码没有问题,但是我需要用包含xml格式数据库的已解码xml文件替换sqlite中的现有数据库文件。如何实现此目的? Any help is highly appreciated and thanks in advance... 非常感谢您的任何帮助,并在此先感谢...

if your solution can be a manual solution you can do this steps: 如果您的解决方案可以是手动解决方案,则可以执行以下步骤:

  1. decode base 64. 解码base 64。
  2. write a code that read xml and generate query (or export xml to csv format using excel or your own code) 编写一个读取xml并生成查询的代码(或使用excel或您自己的代码将xml导出为csv格式)
  3. import the this file to sqlite db using SQL Browser or similar tools. 使用SQL Browser或类似工具将此文件导入sqlite db。

is this your suitable answer? 这是您合适的答案吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM