The Functional XML Querying Tool
|
What is fxgrep? |
|
The Processing Model of fxgrep |
|
The Pattern Language of fxgrep |
|
The Grammar Formalism of fxgrep |
|
Text Patterns |
|
fxgrep Options |
|
fxgrep's Graphical User Interface |
fxgrep parses the input document according to the given parsing options and constructs a document forest from it. This forest is constructed from nodes corresponding to the logical structure of the document:
|
There are three kinds of nodes: text nodes, PI nodes and element nodes:
The document forest is a sequence of nodes. It consists of a single element node representing the document element, preceded or followed by a processing instruction node for each processing instruction which precedes or follows it in the XML document, including those processing instructions that occur within the DTD. |
||||||
|
For a node in the forest, the other children of its parent node are called its siblings; those which precede it are the left siblings and those that follow the right siblings. A descendant of a node is either a child of the node or a descendant of one of its children. Similarly, an ancestor of a node is either its parent or an ancestor of its parent. A node together with its descendants form the subtree rooted at that node. For brevity, when the context is clear, we sometimes identify a node with the element it represents or with the subtree rooted at that node. |
Normally, fxgrep implements a query by consecutive runs of two forest automata, the first traversing from right to left and the second traversing from left to right. The second pass reports all matches of the query in document order.
If the query is simple enough, a single run of an automaton suffices. In this case fxgrep offers two processing modes: Either the automaton is run on the constructed document forest (default), or it is run during parsing, without explicitly constructing the forest. The second method might be slower because it requires demand-driven construction of only those parts of the document forest that might match the query, but it has the advantage of avoiding in-memory construction of the possibly huge document forest. This behavior is controlled by command-line options.