2013-07-31 51 views
0

在libxml2的幫助下,我發現:Python libxml2:xpathEval vs xpathEval2?

xpathEval(self, expr) 
     # Selecting nodes using XPath, a bit slow because the context 
     # is allocated/freed every time but convenient. 

xpathEval2(self, expr) 

這是令人困惑的是xpathEval2不包括進一步的評論。他們之間有什麼不同?

回答

0

在我的版本沒有任何區別,看看Python代碼:

def xpathEval2(self, expr): 
     return self.xpathEval(expr) 

但有註釋掉節這表明,該方法被用於加快分析,雖然有一些內存泄漏:

# # Selecting nodes using XPath, faster because the context 
# # is allocated just once per xmlDoc. 
# # 
# # Removed: DV memleaks c.f. #126735 

檢查您的實現更準確的信息。

+0

非常感謝你@estani :) – comepradz