开发者

Finding parent node of parsed XML in Objective-C

I'm parsing through a bunch of XML and I'm trying to fi开发者_JAVA百科nd if a node is inside / parent of another node before I process it. Is there a way of knowing what the parent of a niode is?


Record the parent node yourself. You're using an event-based parser. It very deliberately keeps track of nothing except what is necessary to ensure the document is well-formed. If you need to know the parent node, record each node in a stack in didStartElement and then pop off the node in didEndElement.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜