KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > xml > dom4j > o3impl > ElementQNameIterator


1 /*
2  * Copyright 2001 (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: ElementQNameIterator.java,v 1.3 2003/06/10 16:18:36 per_nyfelt Exp $
8  */

9
10 package org.ozoneDB.xml.dom4j.o3impl;
11
12 import org.dom4j.Element;
13 import org.dom4j.QName;
14
15 import java.util.Iterator JavaDoc;
16
17 /** <p><code>ElementQNameIterator</code> is a filtering {@link Iterator} which
18  * filters out objects which do not implement the {@link Element}
19  * interface and are not of the correct fully qualified element name.</p>
20  *
21  * @author <a HREF="mailto:james.strachan@metastuff.com">James Strachan</a>
22  * @version $Revision: 1.3 $
23  */

24 public class ElementQNameIterator extends FilterIterator {
25
26     private QName qName;
27
28     public ElementQNameIterator(Iterator JavaDoc proxy, QName qName) {
29         super(proxy);
30         this.qName = qName;
31     }
32
33
34     /** @return true if the given element implements the {@link Element}
35      * interface and matches the given {@link org.dom4j.tree.DefaultQName}
36      */

37     protected boolean matches(Object JavaDoc object) {
38         if (object instanceof Element) {
39             Element element = (Element) object;
40             return qName.equals(element.getQName());
41         }
42         return false;
43     }
44 }
45
46
47 /*
48  * Redistribution and use of this software and associated documentation
49  * ("Software"), with or without modification, are permitted provided
50  * that the following conditions are met:
51  *
52  * 1. Redistributions of source code must retain copyright
53  * statements and notices. Redistributions must also contain a
54  * copy of this document.
55  *
56  * 2. Redistributions in binary form must reproduce the
57  * above copyright notice, this list of conditions and the
58  * following disclaimer in the documentation and/or other
59  * materials provided with the distribution.
60  *
61  * 3. The name "DOM4J" must not be used to endorse or promote
62  * products derived from this Software without prior written
63  * permission of MetaStuff, Ltd. For written permission,
64  * please contact dom4j-info@metastuff.com.
65  *
66  * 4. Products derived from this Software may not be called "DOM4J"
67  * nor may "DOM4J" appear in their names without prior written
68  * permission of MetaStuff, Ltd. DOM4J is a registered
69  * trademark of MetaStuff, Ltd.
70  *
71  * 5. Due credit should be given to the DOM4J Project
72  * (http://dom4j.org/).
73  *
74  * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
75  * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
76  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
77  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
78  * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
79  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
80  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
81  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
82  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
83  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
84  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
85  * OF THE POSSIBILITY OF SUCH DAMAGE.
86  *
87  * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
88  *
89  * $Id: ElementQNameIterator.java,v 1.3 2003/06/10 16:18:36 per_nyfelt Exp $
90  */

91
Popular Tags