Code Monkey home page Code Monkey logo

xpath2.js's People

Contributors

ilinsky avatar neu-rah avatar stevermeister avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xpath2.js's Issues

Reg usage

Hi,
can you please let me know on how to include these files to work on XPath 2.0 expressions?
Thanks,
Jeya

How to get a min.js of this?

Hello,

Great library! How can I get a copy-paste-able version of this library minified? Breaking it up into many files is not practical for my use case (Chrome developer console).

Thanks!

Use a custom function in xpath

Hi,

I would like to use a custom function in xpath, but I don't see any clear documentation on how to do that.

Let's say that I want to use a custom match for regular expressions. How can I write one?

I looked at StaticContext, but it is not clear for me.

Thanks,
Alex.

regular expressions in xpath 2.0

Hey. Is there support for regular expressions in your library?
I tried:
document.evaluate("//*[matches(@Class, 'ars')]", document, null, XPathResult.ANY_TYPE, null).iterateNext();

error:
Uncaught DOMException: Failed to execute 'evaluate' on 'Document': The string '//*[matches(@Class, 'ars')]' is not a valid XPath expression.

Thank you

Example snippet crashing: domClasses missing in xmldom

I'm trying to use your library with my nodeJS application, but when I try to use the snippet you have on your front page (README.md page is the one I'm referring to) I cannot access to the domClasses attribute from the xmldom library.

I've check I'm using the latest version of the xmldom (0.1.22) and the latest of your library too (0.3.2)

Anything that I'm missing? Something have change that makes your snippets unusable?

Thx!

`XPST0017` error when using functions

const xpath = require("xpath2.js");
const xmldom = require("xmldom");
const document = new xmldom.DOMParser().parseFromString("<div><button>Click me</button></div>");
const result = xpath.evaluate("//button[starts-with(., 'Click')]", document);
> node a.js

C:\project\node_modules\xpath2.js\lib\expressions\primary\FunctionCall.js:71
        throw new cException("XPST0017"
        ^
Error
    at Object.<anonymous> (C:\project\node_modules\xpath2.js\lib\classes\Exception.js:17:24)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\project\node_modules\xpath2.js\lib\types\schema\simple\atomic\XSDateTime.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) {
  code: 'XPST0017',
  message: 'Unknown user function: starts-with()'
}

Xqib

Are you familiar with xqib?

Missing reference to cXSUntypedAtomic in XSInteger.js

Hi Sergey,

I have found one little bug in your library. Within a file XSInteger.js in method cXSInteger.cast you have used unreferenced class cXSUntypedAtomic.

so only needed to solve of this problem is add one line of code with reference to it on top of this file.

var cXSUntypedAtomic = require('./../XSUntypedAtomic');

thank you in advance

Ivan

fn:string-join() fails if missing second parameter

The Spec explicitly indicates two signatures:

  1. fn:string-join($arg1 as xs:anyAtomicType*) as xs:string
  2. fn:string-join($arg1 as xs:anyAtomicType*, $arg2 as xs:string) as xs:string

If I pass an xpath like the following: fn:string-join(fn:reverse(fn:tokenize(fn:replace(/Row/IBAG, "(.)", "$1 "), "\s+"))) it will fail unless I explicitly add an empty string for the second parameter fn:string-join(fn:reverse(fn:tokenize(fn:replace(/Row/IBAG, "(.)", "$1 "), "\s+")), "") .

As stated in the spec:

The effect of calling the single-argument version of this function is the same as calling the two-argument version with $arg2 set to a zero-length string.

The function returns an xs:string created by casting each item in the sequence $arg1 to an xs:string, and then concatenating the result strings in order, using the value of $arg2 as a separator between adjacent strings. If the value of $arg2 is the zero-length string, then the members of $arg1 are concatenated without a separator.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.