1. A document-searching system for searching a document having a hierarchical structure with elements separated by element identifiers, comprising: a compiling device for generating a query automaton by storing an input query expression, performing parsing, identifying different types of nodes in said element identifiers; a storage device for storing the query automaton generated by said compiling device; and a query automaton evaluator for reading out said query automaton from said storage device and storing said automaton, while reading in said document and performing a stream search by using states of a plurality of different types of nodes in said element identifiers included in said document and said query automaton and outputting the searched node.