0

I have a lib, which has a API available under uk.ac.ox.cs.diadem.oxpath.oxpath-example

In java I would use it like so

// load from API package uk.ac.ox.cs.diadem.oxpath.oxpath-example; // invoke OXPath OXPath.ENGINE.evaluate(input, browser, outputHandler);

The complete documentation can be found here. Page 30 (last paragraph before section 3.2) says I can embed it in JavaScript, but there is only a java example.

How can I load OXPath into a JavaScript project?

EDIT

I have tried this:

var oxpath = require("uk.ac.ox.cs.diadem.oxpath"); // error

But it throws an error:

Error: Cannot find module 'uk.ac.ox.cs.diadem.oxpath'
Neskews
  • 764
  • 1
  • 10
  • 23

1 Answers1

0

Can you please explain more about your use-case?

"Introduction to OXPath" document provided in your question is not available anymore. This could be because a more recent version have been released in 2018.

Please see here: https://arxiv.org/pdf/1806.10899.pdf

Referring to this document, in section 3.7, page 43 reads:

Different components of OXPath are united under the umbrella name OXPath Project.
The current version of OXPath (2.2.0) and OXPath CLI (1.0.1) are generated by OXPath
Project 1.0.3. It consists of the following main components:
OXPath Core (v.2.2.0) implementing the core functionality of the OXPath language.
WebAPI (v.1.4.0) implementing an interface to web browsers based on Selenium 2.53.1
(only Firefox 47.0.1 is currently supported).
Output Handlers are a set of modules for serialising the output tree of OXPath into
different formats. The following output handlers are available: XMLOutputHandler
for XML (see Section 1.3.1 on page 13), JsonOutputHandler for JSON (see Section 1.3.2 on page 13), RecStreamCSVOutputHandler for rscsv

(see Section 1.3.3 on page 14), HierarchyCSVOutputHandler for hcsv, RecStreamJDBCOutputHandler for rsjdbc (see Section 1.3.4 on page 16), and HierarchyJDBCOutputHandler for hjdbc. OXPath CLI (v.1.0.1) is a command line interface for OXPath. Java documentation API is available at https://oxpath.github.io/api-docs/1.0. 3/javadoc/.

I don't think there is a Javascript API currently, but they could be referring to the fact that you can use java classes into javascript. See here: Use a jar in JavaScript through Java ScriptEngine

However, considering that the underlaying engine relies on selenium opening a browser and navigating the various URL's in your OXPath query, even when using X video frame buffer, OXPath would be unusable in any client code environment

Ylli Prifti
  • 323
  • 3
  • 11