我有一个与HtmlAgilityPack相关的问题
这是html代码
<div class="grid-container">
<div class="grid-header">
<div class="templateclass">
<p-tabView [activeIndex]="activeTabIndex">
<p-tabPanel *ngFor="let note of notes" [header]="note.noteName">
<perfect-scrollbar class="ps-scroll">
<div class="progressbarStyle">
<p-progressBar [value]="note?.percentageCompleted"></p-progressBar>
</div>
<div [innerHTML]="note?.getDisplayHtml()">
</div>
</perfect-scrollbar>
</p-tabPanel>
</p-tabView>
</div>
</div>
</div>下面是我用C#编写的代码
HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
string htmlData = File.ReadAllText(filePath);
htmlDocument.LoadHtml(htmlData);
IEnumerable<HtmlAgilityPack.HtmlNode> tagNodes = htmlDocument.DocumentNode.SelectNodes("//p-tabPanel");为什么总是返回空值的SelectNodes?
我试着找到下面的p-tabView,p-tabPanel,perfect-scrollbar,p-progressBar和div,我只得到了perfect-scrollbar和div的有价值的结果
你觉得那个怎么样?
发布于 2017-10-20 15:56:55
如果你只用小写字母搜索,它是有效的:
IEnumerable<HtmlAgilityPack.HtmlNode> tagNodes = htmlDocument.DocumentNode.SelectNodes("//p-tabpanel");你没有得到的节点都是大写的:p-tabView、p-tabPanel和p-progressBar。
堆栈溢出引用:
我在W3C XPath 1.0 specification中没有找到任何官方的引用。
https://stackoverflow.com/questions/46835242
复制相似问题