简体   繁体   English

加载外部资源/ API

[英]Load external resource/API

I have a lib, which has a API available under uk.ac.ox.cs.diadem.oxpath.oxpath-example 我有一个库,在uk.ac.ox.cs.diadem.oxpath.oxpath-example下有一个可用的API

In java I would use it like so 在Java中,我会像这样使用它

// 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. 第30页(第3.2节之前的最后一段)说我可以将其嵌入JavaScript中,但是只有一个Java示例。

How can I load OXPath into a JavaScript project? 如何将OXPath加载到JavaScript项目中?

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'

Can you please explain more about your use-case? 您能否解释一下您的用例?

"Introduction to OXPath" document provided in your question is not available anymore. 您的问题中提供的“ OXPath简介”文档不再可用。 This could be because a more recent version have been released in 2018. 这可能是因为2018年发布了更新的版本。

Please see here: https://arxiv.org/pdf/1806.10899.pdf 请在这里查看: https : //arxiv.org/pdf/1806.10899.pdf

Referring to this document, in section 3.7, page 43 reads: 参考该文档,在第3.7节第43页中,内容如下:

 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. (请参阅第14页的1.3.3节),用于hcsv的HierarchyCSVOutputHandler,用于rsjdbc的RecStreamJDBCOutputHandler(请参见第16页的1.3.4节)和用于hjdbc的HierarchyJDBCOutputHandler。 OXPath CLI (v.1.0.1) is a command line interface for OXPath. OXPath CLI(v.1.0.1)是OXPath的命令行界面。 Java documentation API is available at https://oxpath.github.io/api-docs/1.0 . Java文档API可从https://oxpath.github.io/api-docs/1.0获得 3/javadoc/. 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. 我不认为目前没有Javascript API,但它们可能是指您可以在JavaScript中使用Java类。 See here: Use a jar in JavaScript through Java ScriptEngine 参见此处: 通过Java ScriptEngine在JavaScript中使用jar

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 但是,考虑到底层引擎依赖于硒打开浏览器并导航OXPath查询中的各种URL,即使使用X视频帧缓冲区, OXPath在任何客户端代码环境中都将无法使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM