我知道它可能看起来像 XML Parsing 帖子的副本,但我真的无法理解节点和委托方法如何表现。我有一个 XML ..
<?xml version="1.0" encoding="UTF-8"?>
<ParticipantService>
<Response>
<CourseProperties>
<CourseTitle>AICC_Flash_Workshop_PPT_to_web_examples</CourseTitle>
<CourseCode>123456</CourseCode>
<Availability>Open</Availability>
<Status>In Progress</Status>
<ImageLink>HTTP://lmsstaging.2xprime.com/images/inprogress_icon.png</ImageLink>
<CategoryCode>0</CategoryCode>
<CategoryDesc>General</CategoryDesc>
</CourseProperties>
<CourseProperties>
<CourseTitle>Behaviours</CourseTitle>
<CourseCode>OBIUS</CourseCode>
<Availability>Open</Availability>
<Status>In Progress</Status>
<ImageLink>HTTP://lmsstaging.2xprime.com/images/inprogress_icon.png</ImageLink>
<CategoryCode>0</CategoryCode>
<CategoryDesc>General</CategoryDesc>
</CourseProperties>
<CourseProperties>
<CourseTitle>Customer Service Skills (Part - one)</CourseTitle>
<CourseCode>css_1</CourseCode>
<Availability>Open</Availability>
<Status>In Progress</Status>
<ImageLink>HTTP://lmsstaging.2xprime.com/images/inprogress_icon.png</ImageLink>
<CategoryCode>0</CategoryCode>
<CategoryDesc>General</CategoryDesc>
</CourseProperties>
……
我的要求是将相关课程详细信息存储到相应的数组中。所以我声明了六个 nsmutablearray,但对如何从 XMl 中检索数据感到困惑。我正在尝试这种方式
在foundCharacters 方法中,我将字符串的值附加为
videoUrlLink = [NSMutableString stringWithString:string];
在 didEndElement 方法中
if ([elementName isEqualToString:@"CourseTitle"]) {
[courseDetailList addObject:string];
}
但在 XMl 结束时,我只能在数组中存储一个值。如果我在某个地方出错了,请告诉我?