c# - How to detect that an XPATH expression is correct? -
is there way (regex or similar, c# preferred) detect if xpath expression correct before using it?
i have been googling time , nothing seems appear.
thanks in advance! carlos.
try , if there thrown xpathexception, mean xpath syntactically wrong.
xmldocument doc = new xmldocument(); xpathnavigator nav = doc.createnavigator(); try { var res = nav.compile(xpath); // ... } catch (xpathexception e) { // handle exception }
Comments
Post a Comment