View Javadoc

1   /*
2    * Copyright (C) 2003-2004 Christian Siefkes <christian@siefkes.net>.
3    * Development of this software is supported by the German Research Society,
4    * Berlin-Brandenburg Graduate School in Distributed Information Systems
5    * (DFG grant no. GRK 316).
6    *
7    * This library is free software; you can redistribute it and/or
8    * modify it under the terms of the GNU Lesser General Public
9    * License as published by the Free Software Foundation; either
10   * version 2.1 of the License, or (at your option) any later version.
11   *
12   * This library is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this library; if not, visit
19   * http://www.gnu.org/licenses/lgpl.html or write to the Free Software
20   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
21   */
22  package de.fu_berlin.ties.xml.dom;
23  
24  import java.io.IOException;
25  
26  import org.dom4j.Element;
27  
28  import de.fu_berlin.ties.ContextMap;
29  import de.fu_berlin.ties.ProcessingException;
30  import de.fu_berlin.ties.text.TokenDetails;
31  
32  /***
33   * Interface for a processor that operates on tokens in XML documents.
34   *
35   * @author Christian Siefkes
36   * @version $Revision: 1.3 $, $Date: 2004/11/19 14:05:09 $, $Author: siefkes $
37   */
38  public interface TokenProcessor {
39  
40      /***
41       * Processes a token in an XML element, optionally modifying the
42       * element or the document it is part of.
43       *
44       * @param element the element containing the token
45       * @param left the textual contents of the element to the left of the
46       * <code>token</code> (in case of mixed contents, only up to the last
47       * preceding child element, if any)
48       * @param details details about the token to process
49       * @param right the textual contents of the element to the right of the
50       * <code>token</code> (in case of mixed contents, only up to the next
51       * following child element, if any)
52       * @param context a map of objects that are made available for processing
53       * @throws IOException if an I/O error occurs
54       * @throws ProcessingException if an error occurs during processing
55       */
56      void processToken(final Element element, final String left,
57              final TokenDetails details, final String right,
58              final ContextMap context) throws IOException, ProcessingException;
59  
60  }