fontoxpath
Advanced tools
Comparing version 3.16.0 to 3.17.0
@@ -426,3 +426,10 @@ /// <reference lib="dom" /> | ||
/** | ||
* Resolves a function name to its resolved QName form | ||
* | ||
* @public | ||
*/ | ||
export declare type FunctionNameResolver = (qname: LexicalQualifiedName, arity: number) => ResolvedQualifiedName; | ||
/** | ||
* @public | ||
* @param xpathString - The XPath for which a bucket should be retrieved | ||
@@ -589,4 +596,14 @@ */ | ||
/** | ||
* An unresolved qualified name. Exists of a prefix and a local name | ||
* | ||
* @public | ||
*/ | ||
export declare type LexicalQualifiedName = { | ||
localName: string; | ||
prefix: string; | ||
}; | ||
/** | ||
* @public | ||
*/ | ||
export declare type Logger = { | ||
@@ -597,4 +614,11 @@ trace: (message: string) => void; | ||
/** | ||
* Resolves a namespace prefix to its URI | ||
* | ||
* @public | ||
*/ | ||
export declare type NamespaceResolver = (prefix: string) => string | null; | ||
/** | ||
* @public | ||
*/ | ||
declare type Node_2 = { | ||
@@ -609,13 +633,84 @@ nodeType: number; | ||
export declare type Options = { | ||
/** | ||
* The current context for a query. Will be passed whenever an extension function is called. Can be | ||
* used to implement the current function in XSLT. | ||
* | ||
* Undefined by default. | ||
* | ||
* @public | ||
*/ | ||
currentContext?: any; | ||
/** | ||
* Whether the query is ran in debug mode. Queries in debug mode output better stacktraces but | ||
* are slower | ||
* | ||
* @public | ||
*/ | ||
debug?: boolean; | ||
/** | ||
* The default function namespace uri. | ||
* | ||
* Defaults to the fn namespace ('http://www.w3.org/2005/xpath-functions'). | ||
* | ||
* @public | ||
*/ | ||
defaultFunctionNamespaceURI?: string; | ||
/** | ||
* Disables caching the compilation result of this expression. For internal use | ||
* | ||
* @public | ||
*/ | ||
disableCache?: boolean; | ||
/** | ||
* A facade that can be used to intercept any methods that will change a document in XQuery | ||
* Update Facility when using the copy/transform syntax. | ||
* | ||
* Defaults to just changing the document. | ||
* | ||
* @public | ||
*/ | ||
documentWriter?: IDocumentWriter; | ||
/** | ||
* Hook that is called whenever a function name is resolved. Can be used to redirect function | ||
* calls to a different implementation. | ||
* | ||
* Example uses are 'joining' multiple function libraries together, like how XForms exposes | ||
* functions in the `fn` namespace in the `xforms-functions` namespace. | ||
* | ||
* This function uses the default function namespace uri combined with the imported modules and | ||
* the namespace resolver by default. | ||
* | ||
* Locally declared namespace resolving always takes precedence. | ||
* | ||
* @public | ||
* | ||
* @param qname - The lexical qualified name of the function that needs resolving | ||
* @param arity - The arity of the function. | ||
* | ||
* @returns The resolved name. | ||
*/ | ||
functionNameResolver?: FunctionNameResolver; | ||
/** | ||
* The language to use. Can be XPath, XQuery or XQuery Update Facility. | ||
*/ | ||
language?: Language; | ||
/** | ||
* Called whenever the `fn:trace()` function is called. Defaults to `console#log` | ||
*/ | ||
logger?: Logger; | ||
/** | ||
* Additional modules to import. Imported modules are always statically known | ||
*/ | ||
moduleImports?: { | ||
[s: string]: string; | ||
}; | ||
namespaceResolver?: (s: string) => string | null; | ||
/** | ||
* How to resolve element namespaces. Defaults to returning `null`, which is the default | ||
* namespace uri _or_ an error when resolving a prefix. | ||
*/ | ||
namespaceResolver?: NamespaceResolver; | ||
/** | ||
* How to create new elements when using XQuery or XQuery Update Facility. Defaults to creating | ||
* elements using the document implementation related to the passed context node. | ||
*/ | ||
nodesFactory?: INodesFactory; | ||
@@ -788,4 +883,14 @@ }; | ||
/** | ||
* A qualified name, consists of a localname and a namespace URI | ||
* | ||
* @public | ||
*/ | ||
export declare type ResolvedQualifiedName = { | ||
localName: string; | ||
namespaceURI: string; | ||
}; | ||
/** | ||
* @public | ||
*/ | ||
declare enum ReturnType_2 { | ||
@@ -792,0 +897,0 @@ ANY = 0, |
@@ -0,0 +0,0 @@ MIT License |
{ | ||
"name": "fontoxpath", | ||
"version": "3.16.0", | ||
"version": "3.17.0", | ||
"description": "A minimalistic XPath 3.1 engine in JavaScript", | ||
@@ -5,0 +5,0 @@ "main": "dist/fontoxpath.js", |
@@ -81,2 +81,3 @@ # fontoxpath  [](https://david-dm.org/FontoXML/fontoxpath#info=devDependencies) [](http://badge.fury.io/js/fontoxpath) [](https://bundlephobia.com/result?p=fontoxpath) [](https://coveralls.io/github/FontoXML/fontoxpath?branch=master) [](https://snyk.io/test/github/FontoXML/fontoxpath?targetFile=package.json) [](https://www.codefactor.io/repository/github/fontoxml/fontoxpath) | ||
* `defaultFunctionNamespaceURI` `<string>` To modify or change the default function namespaceURI. Defaults to `http://www.w3.org/2005/xpath-functions`. Defining the default function namespaceURI in the xpath expression overwrites this option. | ||
* `functionNameResolver` `<({prefix, localName}, arity) => {namespaceURI, localName}>` To influence the function name resolving algorithm. Useful to extend the protected namespaces, such as the `fn` namespace. | ||
@@ -387,6 +388,9 @@ ### Example | ||
This engine is pretty DOM-agnostic, it has a good track record with the browser DOM implementations | ||
and [slimdom.js](https://github.com/bwrrp/slimdom.js). There are a number of known issues with | ||
[xmldom](https://github.com/jindw/xmldom) because it does not follow the DOM spec on some features | ||
including namespaces. | ||
and [slimdom.js](https://github.com/bwrrp/slimdom.js). There are a number of known issues with other | ||
DOM implementations such as [xmldom](https://github.com/jindw/xmldom) because it does not follow the | ||
DOM spec on some features including namespaces. | ||
When using namespaces in general, be sure to not use the HTML DOM since it does not always implement | ||
namespaces how you'd expect! | ||
## Contribution | ||
@@ -393,0 +397,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
839095
4286
399