When having to pass JavaScript values as variables to an evaluateXPath call you can create a typed value of it to ensure it will be used as that speci

FontoXML / fontoxpath Public

submited by
Style Pass
2021-09-28 06:30:05

When having to pass JavaScript values as variables to an evaluateXPath call you can create a typed value of it to ensure it will be used as that specific type.

If you do not do this and instead pass a plain JavaScript value as variable it will get converted automatically into a type which fits but you will not be able to control the exact type.

FontoXPath can output a basic trace for an error if the debug option is set to true. This is disabled by default because of performance reasons.

FontoXPath can use the Performance API to provide some insight in the speed of XPaths. To use it, first give FontoXPath an implementation of the Performance interface:

This summary contains an array of XPaths, their execution times, their total runtime and their average runtime. Starting a performance profile will also output measurements on the timeline of the performance profiler of the browser.

The arguments are the same as evaluateXPath. This returns a Promise<Object>, the object has a xdmValue and pendingUpdateList. The xdmValue is the result of query as if it was run using evaluateXPath with evaluateXPath.ANY_TYPE as returnType. The pendingUpdateList is an <Object[]> in which each entry represents an update primitive where the type identifies the update primitive.

Leave a Comment
Related Posts