2014-02-17 2 views
4

Просматривает недействительное исключение токена. Исключение не бросается каждый раз, и XPath статичен. Не уверен что происходит.HtmlAgilityPack XPath Неверный токен

doc.DocumentNode.SelectSingleNode("//*[contains(@itemprop,'softwareVersion')]"); 

.

Message: 

'//*[contains(@itemprop,'softwareVersion')]' has an invalid token. 


StackTrace: 

at MS.Internal.Xml.XPath.XPathParser.CheckToken(LexKind t) 
at MS.Internal.Xml.XPath.XPathParser.ParsePredicate(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParseStep(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParseRelativeLocationPath(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParseLocationPath(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParsePathExpr(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParseUnionExpr(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParseUnaryExpr(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParseMultiplicativeExpr(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParseAdditiveExpr(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParseRelationalExpr(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParseEqualityExpr(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParseAndExpr(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParseOrExpr(AstNode qyInput) 
at MS.Internal.Xml.XPath.XPathParser.ParseXPathExpresion(String xpathExpresion) 
at System.Xml.XPath.XPathExpression.Compile(String xpath, IXmlNamespaceResolver nsResolver) 
at System.Xml.XPath.XPathNavigator.Select(String xpath) 
at HtmlAgilityPack.HtmlNode.SelectSingleNode(String xpath) 

Я также вижу это иногда для этого, с той же недопустимой лексемы исключением

doc.DocumentNode.SelectNodes("//*[contains(@class,'item')]"); 
+0

Есть ли способ поднять вопрос, чтобы он мог получить больше просмотров? – chriszorn

+0

Вы можете начать щедрость, но я думаю, что вам может понадобиться больше репутации. –

ответ

0

Try без "*":

doc.DocumentNode.SelectSingleNode("//[contains(@itemprop,'softwareVersion')]");

Смежные вопросы