ElementModifier xref

View Javadoc

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