【发布时间】:2011-09-24 22:27:55
【问题描述】:
我有一个 XML,我正在将数据转换为如下格式:
<Question>
<QuestionID>1</QuestionID>
<QuestionType>Logic</QuestionType>
<QuestionImage>http://mobilecms.hiteshi.com/IQ/xml/Logic/1/Question/q.jpg</QuestionImage>
<QuestionText>1 Which is the Next image?</QuestionText>
<AnswerImages Count="4">
<Image>http://mobilecms.hiteshi.com/IQ/xml/Logic/1/Answer/a.jpg</Image>
<Image>http://mobilecms.hiteshi.com/IQ/xml/Logic/1/Answer/b.jpg</Image>
<Image>http://mobilecms.hiteshi.com/IQ/xml/Logic/1/Answer/c.jpg</Image>
<Image>http://mobilecms.hiteshi.com/IQ/xml/Logic/1/Answer/d.jpg</Image>
</AnswerImages>
<Answer>d</Answer>
<Score>1</Score>
<DifficultyLevel>1</DifficultyLevel>
</Question>
我必须读取该 XML 并将所有标签数据存储到两个不同的 sqlite 表中。我可以轻松读取诸如 QuestionID、QuestionType 等主要标签,并将其存储到 tableOne 中。
现在我想读取其中包含计数的 AnswerImages 标记,并根据该计数变量包含名为 <Image> 的子标记。这里我想将所有<Image>标签数据存入tableTwo。
如何将数据同时存储到 tableOne 和 tableTwo 中?
【问题讨论】:
-
请更正链接。如果您不知道该怎么做,请在发布之前先检查一下。而且就个人而言,这里最好粘贴xml而不是链接。
-
您使用什么语言,什么平台?我们是否可以通过您的用户名假设这是一个 iphone 应用程序?知道这些问题的答案将有助于人们推荐可用的解析器,这样您就不必自己动手了。