Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.help.search
Class XMLSearchParticipant

java.lang.Object
  extended by 

org.eclipse.help.search.LuceneSearchParticipant
      extended by 
org.eclipse.help.search.XMLSearchParticipant

public abstract class XMLSearchParticipant
extends LuceneSearchParticipant

An abstract search participants for adding XML documents to the Lucene search index. Subclass it and implement or override protected methods to handle parsing of the document.

Since:
3.2

Nested Class Summary
protected static interface XMLSearchParticipant.IParsedXMLContent
          Class that implements this interface is used to store data obtained during the parsing phase.
 
Constructor Summary
XMLSearchParticipant ()
           
 
Method Summary
  IStatus addDocument ( ISearchIndex index, String pluginId, String name, URL url, String id, org.apache.lucene.document.Document doc)
          Adds the document to the search index.
protected   String getElementStackPath ()
          Returns the full path of the current element in the stack separated by the '/' character.
protected   String getTopElement ()
          Returns the name of the element that is currently at the top of the element stack.
protected  void handleEndDocument ( XMLSearchParticipant.IParsedXMLContent data)
          Called when the XML document has been ended.
protected abstract  void handleEndElement ( String name, XMLSearchParticipant.IParsedXMLContent data)
          Called when the element has been ended.
protected  void handleProcessingInstruction ( String type, XMLSearchParticipant.IParsedXMLContent data)
          Called when a processing instruction has been encountered.
protected  void handleStartDocument ( XMLSearchParticipant.IParsedXMLContent data)
          Called when the XML document has been started.
protected abstract  void handleStartElement ( String name, Attributes attributes, XMLSearchParticipant.IParsedXMLContent data)
          Called when the element has been started.
protected abstract  void handleText ( String text, XMLSearchParticipant.IParsedXMLContent data)
          Called when element body text has been encountered.
protected   InputStream preprocess ( InputStream in, String name, String locale)
           Pre-processes the given document input stream for the given document name and locale.
 
Methods inherited from class org.eclipse.help.search. LuceneSearchParticipant
addTitle, clear, getAllDocuments, getContributingPlugins, getId, init, open, resolveVariables
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLSearchParticipant

public XMLSearchParticipant()
Method Detail

handleStartElement

protected abstract void handleStartElement(
String name,
                                           
Attributes attributes,
                                           
XMLSearchParticipant.IParsedXMLContent data)
Called when the element has been started.

Parameters:
name - the element name
attributes - the element attributes
data - data the parser content data to update

handleEndElement

protected abstract void handleEndElement(
String name,
                                         
XMLSearchParticipant.IParsedXMLContent data)
Called when the element has been ended.

Parameters:
name - the name of the XML element
data - data the parser content data to update

handleStartDocument

protected void handleStartDocument(
XMLSearchParticipant.IParsedXMLContent data)
Called when the XML document has been started.

Parameters:
data - data the parser content data to update

handleEndDocument

protected void handleEndDocument(
XMLSearchParticipant.IParsedXMLContent data)
Called when the XML document has been ended.

Parameters:
data - data the parser content data to update

handleProcessingInstruction

protected void handleProcessingInstruction(
String type,
                                           
XMLSearchParticipant.IParsedXMLContent data)
Called when a processing instruction has been encountered.

Parameters:
type - the instruction data
data - the parser content data to update

handleText

protected abstract void handleText(
String text,
                                   
XMLSearchParticipant.IParsedXMLContent data)
Called when element body text has been encountered. Use 'getElementStackPath()' to determine the element in question.

Parameters:
text - the body text
data - the parser content data to update

addDocument

public 
IStatus addDocument(
ISearchIndex index,
                           
String pluginId,
                           
String name,
                           
URL url,
                           
String id,
                           org.apache.lucene.document.Document doc)
Description copied from class: LuceneSearchParticipant
Adds the document to the search index.

Specified by:
addDocument in class LuceneSearchParticipant
Parameters:
index - the abstract representation of the help index that is currently running. Indexing known file types in participants that manage documents outside the TOC can be delegated to the index.
pluginId - the plug-in that owns the document
name - the name of the document to index
url - the url of the document to index
id - the unique id associated with this document
doc - the Lucene document to add searchable content to
Returns:
the status of the indexing operation. A successful operation should return Status.OK.

getTopElement

protected 
String getTopElement()
Returns the name of the element that is currently at the top of the element stack.

Returns:
the name of the element that is currently at the top of the element stack

getElementStackPath

protected 
String getElementStackPath()
Returns the full path of the current element in the stack separated by the '/' character.

Returns:
the path to the current element in the stack.

preprocess

protected 
InputStream preprocess(
InputStream in,
                                 
String name,
                                 
String locale)

Pre-processes the given document input stream for the given document name and locale. This implementation will resolve dynamic content that is applicable to searching, e.g. includes and extensions, but not filters. Subclasses may override to do their own pre-processing.

For performance, implementations that handle documents that do not support dynamic content should subclass and return the original stream.

Parameters:
in - the input stream for the document content
name - the name of the document as it appears in the index
locale - the locale code, e.g. "en_US"
Returns:
the processed content
Since:
3.3

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire