我总是从Stack Overflow中获得关键问题的解决方案。首先,我要感谢SO的所有团队成员。我的问题是我在Android旁边有和XML文件。我希望android读取此文件并从该文件创建树,树视图遵循pass和fail的测试条件。如何读取xml文件并从中创建树。请指导和帮助。
在记事本上创建xml文件。此xml文件的内容为:
<?xml version="1.0" encoding="utf-8"?>
<Parent Node name="Unit Testing" result="Passed">
<Child Node name="GetCampaignTestclass" result="" methodName="">
<Sub Child Node name="CampaignPageShouldNotBeNull" result="Failed" methodName="GetCampaignPages"></Sub Child Node>
<Sub Child Node name="CampaignServiceObjectShouldNotBeNull" result="Passed" methodName="GetCampaignService"></Child Node>
</Sub Child Node>
<Child Node name="GetAdGroupTestclass" result="" methodName="">
<Sub Child Node name="AdGroupPageShouldNotBeNull" result="Failed" methodName="GetAdGroupPages"></Sub Child Node>
<Sub Child Node name="AdGroupServiceObjectShouldNotBeNull" result="Passed" methodName="GetAdGroupService"></Sub Child Node>
</Sub Child Node>
<Child Node name="GetTextAdTestclass" result="" methodName="">
<Sub Child Node name="AdGroupAdPageShouldNotBeNull" result="Failed" methodName="GetTextAdPages"></Sub Child Node>
<Sub Child Node name="AdGroupServiceObjectShouldNotBeNull" result="Passed" methodName="GetTextAdService"></Sub Child Node>
</Sub Child Node>
<Child Node name="GetKeywordsTestclass" result="" methodName="">
<Sub Child Node name="AdGroupCriterionPageShouldNotBeNull" result="Failed" methodName="GetAdGroupCriterionPages"></Sub Child Node>
<Sub Child Node name="AdGroupCriterionServiceObjectShouldNotBeNull" result="Passed" methodName="GetAdGroupCriterionService"></Sub Child Node>
</Sub Child Node>
</Parent Node>
我可以在android中创建这个xml文件并从中读取节点数据吗?怎么样?