【发布时间】:2017-04-11 22:05:55
【问题描述】:
我已经尝试了很多使用 XPath 表达式从下面的元素获取项目,但这对我来说似乎有点误导。
我想用 XPath 定位的字符串是
Excel VBA 用户表单视频 | Excel VBA Forms Pt 1 - 绘图表格
我试过的 XPath 表达式是:
//h1[@class="gamma"]/text()
我的 XML 代码是:
<div class="woVideoShowPost">
<h1 class="gamma">
Excel VBA videos | Excel VBA Part 2 - Writing Your First Macro
</h1>
<p class="woVideoPosted">
Posted by
<a href="/videos/author/andrewgould.htm">Andrew Gould</a>
on 10 May 2013
</p>
<p>VBA, or Visual Basic for Applications, is a powerful tool that you can use to automate Microsoft Excel. This video introduces you to the basics of writing code in the VB Editor, including how to create a new module, how to write a subroutine, some best practice guidelines for laying out your code and adding comments, and how to write simple VBA instructions. We'll also show you how to run the simple procedure that you'll write, and how to ensure that you can save your code and reopen the file which contains it.</p>
<p></p>
<div class="woVideoWrapper">
<div class="woVideoWrapped">
<iframe width="100%" height="100%" src="http://www.youtube.com/embed/7RVGdA9AhrY" allowfullscreen=""></iframe>
</div>
</div>
<p class="woVideoShowTipTitle">You can increase the size of the video:</p>
<div class="woVideoShowTip">
<img alt="Full screen mode for YouTube" src="../../files/videos/images/youtube.jpg">
<p>You can view the video in full screen mode as shown on the left, using the icon at the bottom right of the frame.</p>
</div>
<p class="woVideoShowTipTitle">You can also increase the quality of the video:</p>
<div class="woVideoShowTip">
<img alt="Changing resolution" src="../../files/videos/images/youtube2.jpg">
<p>
You can improve the resolution of the video using another icon at the bottom right of the frame. This will slow down the connection speed,
but increase the display and sound quality. This icon only becomes visible when you start playing the video.
</p>
</div>
<p class="woVideoShowTipTitle">
Finally, if nothing happens when you play the video, check that you're not using <a href="../../blog/s312/compatibility-view.htm">IE in compatibility view</a>.
</p>
</div>
【问题讨论】:
-
您的 XPath 表达式看起来不错:在什么方面它“似乎具有误导性”?
-
你显然做错了什么,我不知道是什么。对不起!