org.vfny.geoserver.zserver
Class XMLDocument

java.lang.Object
  extended byorg.vfny.geoserver.zserver.XMLDocument

public class XMLDocument
extends java.lang.Object

A utility for making lucene document from an XML source and a mapping of attributes consisting of a use number and the xpath of the name. Based on Document example from Lucene. Taken from the lucene mailing list: http://www.mail-archive.com/lucene-user@jakarta.apache.org/msg00346.html and modified to work with the Geo Profile. email details: From: carlson Subject: Re: Indexing other documents type than html and txt (XML) Date: Thu, 29 Nov 2001 09:03:53 -0800


Field Summary
static java.lang.String WHITE_SPACE
           
 
Method Summary
static org.apache.lucene.document.Document Document(java.io.File documentFile, java.io.File attrMapFile)
          Turns the File into a lucene.
static org.apache.lucene.document.Document Document(java.io.File file, java.util.Properties attrMap)
          Converts an xml file to a lucene document, using the values of the attribute map as the xpaths.
static org.apache.lucene.document.Document Document(java.lang.String path, java.util.Properties attrMap)
          Convenience method, turns the string into a file.
static org.apache.lucene.document.Document Document(java.lang.String documentPath, java.lang.String propertyPath)
          Convenience method, turns the documentPath into a file, and the propertyPath into a Property object.
static void main(java.lang.String[] args)
          main used to create an index from a directory full of xml files.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHITE_SPACE

public static final java.lang.String WHITE_SPACE
See Also:
Constant Field Values
Method Detail

Document

public static org.apache.lucene.document.Document Document(java.io.File file,
                                                           java.util.Properties attrMap)
                                                    throws java.io.FileNotFoundException,
                                                           java.lang.Exception
Converts an xml file to a lucene document, using the values of the attribute map as the xpaths. These xpaths also serve as the name of the fields for conversions later.

Parameters:
file - Document that to be converted to a lucene document
attrMap - mappings of attribute numbers to xpaths.
Returns:
lucene document
Throws:
java.io.FileNotFoundException
java.lang.Exception

Document

public static org.apache.lucene.document.Document Document(java.lang.String path,
                                                           java.util.Properties attrMap)
                                                    throws java.lang.Exception
Convenience method, turns the string into a file.

Parameters:
path - path of document you want to convert to a lucene document
attrMap - properties where the key is the field name and the value is the XML xpath.
Returns:
lucene document
Throws:
java.lang.Exception

Document

public static org.apache.lucene.document.Document Document(java.lang.String documentPath,
                                                           java.lang.String propertyPath)
                                                    throws java.lang.Exception
Convenience method, turns the documentPath into a file, and the propertyPath into a Property object.

Parameters:
documentPath - path of the Document that to be converted to a lucene document
propertyPath - path of file containing mapping of attribute use numbers to xpaths. XML xpath.
Returns:
Throws:
java.lang.Exception

Document

public static org.apache.lucene.document.Document Document(java.io.File documentFile,
                                                           java.io.File attrMapFile)
                                                    throws java.lang.Exception
Turns the File into a lucene. XMLDocument.

Parameters:
documentFile - Document that to be converted to a lucene document.
attrMapFile - file containing mappings with xpath values. XML xpath.
Returns:
Throws:
java.lang.Exception

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
main used to create an index from a directory full of xml files.

Throws:
java.lang.Exception