Using XPath toolbar with HTML5 in v.22

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
dsewell
Posts: 124
Joined: Mon Jun 09, 2003 6:02 pm
Location: Charlottesville, Virginia USA

Using XPath toolbar with HTML5 in v.22

Post by dsewell » Mon Feb 17, 2020 6:05 pm

According to the "What's New" information for oXygen 22.0, "You can use the XPath Toolbar or XPath Builder View to quickly query HTML documents using XPath expressions." I tried to test this out on a minimal HTML 5 file:

Code: Select all

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>Title</title>
    <link rel="stylesheet" href="style.css">
    <script src="script.js"></script>
  </head>
  <body>
    <div>
      <p>This is a very simple test of <a href="https://www.oxygenxml.com">oXygen</a> support for XPath in HTML 5</p>
    </div>
  </body>
</html>
This is valid HTML 5 and oXygen's Validate function reports that it is valid. But if I try to search on any XPath, like //p, I get the error message:
XPath failed due to: The element type "link" must be terminated by the matching end-tag "</link>"
Am I doing something wrong? I thought the idea was that XPath would be possible on valid HTML5 even if it is not well-formed XML?

tavy
Posts: 235
Joined: Thu Jul 01, 2004 12:29 pm

Re: Using XPath toolbar with HTML5 in v.22

Post by tavy » Tue Feb 18, 2020 9:54 am

Hello,

Thanks for your feedback.
Unfortunately I cannot reproduce de problem. I tested with <oXygen/> XML Editor 22.0, build 2020021016, I created a new HTML file and pasted the content you provided, then run the XPath //p. The XPath result was returned correctly for the HTML5 document.
Maybe you associated the HTML files with the XHTML editor. You can verify this in the Preferences dialog, go to Options->Preferences->File Types options page, and search for "html" extension. In case the extension is associated with the "XHTML Editor", change it to "HTML Editor". Then reopen the file and run the XPath expression again.

Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com

dsewell
Posts: 124
Joined: Mon Jun 09, 2003 6:02 pm
Location: Charlottesville, Virginia USA

Re: Using XPath toolbar with HTML5 in v.22

Post by dsewell » Tue Feb 18, 2020 4:30 pm

Yes, your guess was correct. I had changed the file type preference at some time in the past and forgot about that. After changing the preference as suggested, XPath works. Thanks!

Post Reply