开发者

Does NSXMLNode's nodesForXPath:error: guarantee a specific ordering?

I extr开发者_开发技巧act nodes from an XML document by calling -nodesForXPath:error:. Now i wonder if it guarantees, that the nodes are returned in the same order as they appear from top to bottom in the document (it's crucial in my case).

My XML looks something like this and i retrieve the b tags with the XPath query:

<a>
    <b>
    ...    
    </b>
    <b>
    ...    
    </b>
<a>

Unfortunately the b tags do not have an explicit counter.


While the documentation for NSXMLNode doesn't state explicitly if order is preserved, I believe it will be because XML documents are inherently ordered. Also, a method that does not have a deterministic result set will usually have that fact stated; something that hasn't been done for NSXMLNode.

With that said, the only way to find out for sure is to run some tests on your data.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜