Driver notion

Generalities

As said in the introduction, XPathFinder uses the native Java mechanism to load DOM from XML files and to execute XPath queries.

However, Java supports only the 1.0 XPath version and a limited DOM management.

This is why, if needed, XPathFinder allows to define drivers to use in function of file type (identified by its extension). Thus, it is possible to execute searches by Java for XML files (for example), to use Saxon for FO files (other example) and a personal engine for INI files.

Of course, INI files are not XML files. But if the definition driver define a class able to build DOM based on data stream, there is no limit for XPathFinder management.

Driver definition

A driver is defined by the following information:

  • a set of extension file (the sets must be disjointed)
  • a set of jars (containing the needed classes for driver execution)
  • definition of the class able to build DOM (javax.xml.parsers.DocumentBuilderFactory) - optionnal
  • definition of the class able to build XPath queries (javax.xml.xpath.XPathFactory) - optionnal
  • read options:
    • skip DOCTYPE: allows to skip DOCTYPE clause existing in the file to read, the parser will not see the clause
    • skip entities: if custom entities have been defined in the document DOCTYPE, the skip DOCTYPE operation can introduce parsing errors, this opton replaces the amperstand characters by the XML entity &, thus, the parser will ignore the entity declaration
    • skip namespaces: if the XML document contains namespaces, in function of the driver used, they can be taken in account complicating the XPath queries, this option allows to remove the namespace usage before parsing operation - recommanded for Saxon usage

Information

  • If optional elements in driver definition are not filled, the search engine will use the basic Java implementation.
  • The search is done with heterogeneous driver definition. Each file found is automatically associated to a driver and it is this one that will be used to search.