Patent ID: 7457799

Claim:
A search apparatus which searches data of a document structured using a tag based on a search condition, comprising: a generation device analyzing the search condition and generating tag registration information including a registered character string of a tag indicating each element contained in a search path specified by the search condition, keyword registration information including a registered character string of a keyword specified by the search condition, and state management information for management of a current search state using the search path; a read device sequentially reading document data of a structured document to be searched by a predetermined amount; and a search device searching the document data of the structured document while switching repeatedly from a tag search of detecting a tag registered in the tag registration information from among a read data string to a keyword search of detecting a keyword registered in the keyword registration information from among a read data string using the state management information and from the keyword search to the tag search, and outputting a search result, wherein the search apparatus is configured to perform: generating the state management information containing information for management of correspondence between the current search state and an element in the search path, and information designating a state in which the tag search is to be switched into the keyword search; referring to the state management information when the registered tag is detected by the tag search; and switching from the tag search to the keyword search when the current search state is the state in which the tag search is to be switched into the keyword search.