001/*
002 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
003 * 
004 * This software is open source. 
005 * See the bottom of this file for the licence.
006 * 
007 * $Id: Visitor.java,v 1.1 2001/01/19 05:58:39 jstrachan Exp $
008 */
009
010package org.dom4j;
011
012/** <p><code>Visitor</code> is used to implement the <code>Visitor</code> 
013  * pattern in DOM4J.
014  * An object of this interface can be passed to a <code>Node</code> which will 
015  * then call its typesafe methods.
016  * Please refer to the <i>Gang of Four</i> book of Design Patterns
017  * for more details on the <code>Visitor</code> pattern.</p>
018  *
019  * <p> This 
020  * <a href="http://rampages.onramp.net/~huston/dp/patterns.html">article</a>
021  * has further discussion on design patterns and links to the GOF book.
022  * This <a href="http://rampages.onramp.net/~huston/dp/visitor.html">link</a>
023  * describes the Visitor pattern in detail.
024  * </p>
025  *
026  * @author <a href="mailto:james.strachan@metastuff.com">James Strachan</a>
027  * @version $Revision: 1.1 $
028  */
029public interface Visitor {
030
031    /** <p>Visits the given <code>Document</code></p>
032      *
033      * @param node is the <code>Document</code> node to visit.
034      */
035    public void visit(Document document);
036
037    /** <p>Visits the given <code>DocumentType</code></p>
038      *
039      * @param node is the <code>DocumentType</code> node to visit.
040      */
041    public void visit(DocumentType documentType);
042
043    /** <p>Visits the given <code>Element</code></p>
044      *
045      * @param node is the <code>Element</code> node to visit.
046      */
047    public void visit(Element node);
048
049    /** <p>Visits the given <code>Attribute</code></p>
050      *
051      * @param node is the <code>Attribute</code> node to visit.
052      */
053    public void visit(Attribute node);
054
055    /** <p>Visits the given <code>CDATA</code></p>
056      *
057      * @param node is the <code>CDATA</code> node to visit.
058      */
059    public void visit(CDATA node);
060
061    /** <p>Visits the given <code>Comment</code></p>
062      *
063      * @param node is the <code>Comment</code> node to visit.
064      */
065    public void visit(Comment node);
066
067    /** <p>Visits the given <code>Entity</code></p>
068      *
069      * @param node is the <code>Entity</code> node to visit.
070      */
071    public void visit(Entity node);
072
073    /** <p>Visits the given <code>Namespace</code></p>
074      *
075      * @param node is the <code>Namespace</code> node to visit.
076      */
077    public void visit(Namespace namespace);
078
079    /** <p>Visits the given <code>ProcessingInstruction</code>
080     * </p>
081     *
082     * @param node is the <code>ProcessingInstruction</code> node to visit.
083     */
084    public void visit(ProcessingInstruction node);
085
086    /** <p>Visits the given <code>Text</code>
087     * </p>
088     *
089     * @param node is the <code>Text</code> node to visit.
090     */
091    public void visit(Text node);
092
093}
094
095
096
097
098/*
099 * Redistribution and use of this software and associated documentation
100 * ("Software"), with or without modification, are permitted provided
101 * that the following conditions are met:
102 *
103 * 1. Redistributions of source code must retain copyright
104 *    statements and notices.  Redistributions must also contain a
105 *    copy of this document.
106 *
107 * 2. Redistributions in binary form must reproduce the
108 *    above copyright notice, this list of conditions and the
109 *    following disclaimer in the documentation and/or other
110 *    materials provided with the distribution.
111 *
112 * 3. The name "DOM4J" must not be used to endorse or promote
113 *    products derived from this Software without prior written
114 *    permission of MetaStuff, Ltd.  For written permission,
115 *    please contact dom4j-info@metastuff.com.
116 *
117 * 4. Products derived from this Software may not be called "DOM4J"
118 *    nor may "DOM4J" appear in their names without prior written
119 *    permission of MetaStuff, Ltd. DOM4J is a registered
120 *    trademark of MetaStuff, Ltd.
121 *
122 * 5. Due credit should be given to the DOM4J Project
123 *    (http://dom4j.org/).
124 *
125 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
126 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
127 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
128 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
129 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
130 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
131 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
132 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
133 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
134 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
135 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
136 * OF THE POSSIBILITY OF SUCH DAMAGE.
137 *
138 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
139 *
140 * $Id: Visitor.java,v 1.1 2001/01/19 05:58:39 jstrachan Exp $
141 */