View Javadoc

1   /*
2    * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
3    * 
4    * This software is open source. 
5    * See the bottom of this file for the licence.
6    * 
7    * $Id: ElementModifier.java,v 1.1 2004/08/02 18:44:07 maartenc Exp $
8    */
9   
10  package org.dom4j.io;
11  
12  import org.dom4j.Element;
13  
14  /***
15   * ElementModifier defines a modifier of {@link org.dom4j.Element} objects.<br>
16   * It can be used in the event based {@link org.dom4j.io.SAXModifier}, in order to modify
17   * elements on the fly, rather than waiting until the complete document is parsed.
18   * 
19   * @author Wonne Keysers (Realsoftware.be)
20   */
21  public interface ElementModifier {
22  
23     /***
24      * Called by an event based processor when an elements closing tag is encountered.
25      * This method must return the modified version of the provided {@link org.dom4j.Element}
26      * or null if it has to be removed from the document.<br>
27      * The incoming {@link org.dom4j.Element} is disconnected from the DOM4J tree. 
28      * This means that navigation to the elements parent {@link org.dom4j.Element}
29      * and {@link org.dom4j.Document} are not available. Only the element itself can be modified!
30      * 
31      * @param element {@link org.dom4j.Element} to be parsed
32      * @return the modified {@link org.dom4j.Element}
33      * @throws Exception of any kind
34      */
35     public Element modifyElement(Element element) throws Exception;
36  
37  }
38  
39  
40  
41  
42  /*
43   * Redistribution and use of this software and associated documentation
44   * ("Software"), with or without modification, are permitted provided
45   * that the following conditions are met:
46   *
47   * 1. Redistributions of source code must retain copyright
48   *    statements and notices.  Redistributions must also contain a
49   *    copy of this document.
50   *
51   * 2. Redistributions in binary form must reproduce the
52   *    above copyright notice, this list of conditions and the
53   *    following disclaimer in the documentation and/or other
54   *    materials provided with the distribution.
55   *
56   * 3. The name "DOM4J" must not be used to endorse or promote
57   *    products derived from this Software without prior written
58   *    permission of MetaStuff, Ltd.  For written permission,
59   *    please contact dom4j-info@metastuff.com.
60   *
61   * 4. Products derived from this Software may not be called "DOM4J"
62   *    nor may "DOM4J" appear in their names without prior written
63   *    permission of MetaStuff, Ltd. DOM4J is a registered
64   *    trademark of MetaStuff, Ltd.
65   *
66   * 5. Due credit should be given to the DOM4J Project - 
67   *    http://www.dom4j.org
68   *
69   * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
70   * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
71   * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
72   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
73   * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
74   * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
75   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
76   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
77   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
78   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
79   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
80   * OF THE POSSIBILITY OF SUCH DAMAGE.
81   *
82   * Copyright 2001-2004 (C) MetaStuff, Ltd. All Rights Reserved.
83   *
84   * $Id: ElementModifier.java,v 1.1 2004/08/02 18:44:07 maartenc Exp $
85   */