/*--
$Id: Element.java,v 1.152 2004/09/03 06:35:39 jhunter Exp $
Copyright (C) 2000-2004 Jason Hunter & Brett McLaughlin.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions, and the disclaimer that follows
these conditions in the documentation and/or other materials
provided with the distribution.
3. The name "JDOM" must not be used to endorse or promote products
derived from this software without prior written permission. For
written permission, please contact <request_AT_jdom_DOT_org>.
4. Products derived from this software may not be called "JDOM", nor
may "JDOM" appear in their name, without prior written permission
from the JDOM Project Management <request_AT_jdom_DOT_org>.
In addition, we request (but do not require) that you include in the
end-user documentation provided with the redistribution and/or in the
software itself an acknowledgement equivalent to the following:
"This product includes software developed by the
JDOM Project (http://www.jdom.org/)."
Alternatively, the acknowledgment may be graphical using the logos
available at http://www.jdom.org/images/logos.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE JDOM AUTHORS OR THE PROJECT
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
This software consists of voluntary contributions made by many
individuals on behalf of the JDOM Project and was originally
created by Jason Hunter <jhunter_AT_jdom_DOT_org> and
Brett McLaughlin <brett_AT_jdom_DOT_org>. For more information
on the JDOM Project, please see <http://www.jdom.org/>.
*/
package org.jdom;
import java.io.*;
import java.util.*;
import org.jdom.filter.*;
/**
* An XML element. Methods allow the user to get and manipulate its child
* elements and content, directly access the element's textual content,
* manipulate its attributes, and manage namespaces.
*
* @version $Revision: 1.152 $, $Date: 2004/09/03 06:35:39 $
* @author Brett McLaughlin
* @author Jason Hunter
* @author Lucas Gonze
* @author Kevin Regan
* @author Dan Schaffer
* @author Yusuf Goolamabbas
* @author Kent C. Johnson
* @author Jools Enticknap
* @author Alex Rosen
* @author Bradley S. Huffman
*/
public class Element extends Content implements Parent {
private static final String CVS_ID =
"@(#) $RCSfile: Element.java,v $ $Revision: 1.152 $ $Date: 2004/09/03 06:35:39 $ $Name: jdom_1_0 $";
private static final int INITIAL_ARRAY_SIZE = 5;
/** The local name of the element */
protected String name;
/** The namespace of the element */
protected transient Namespace namespace;
/** Additional namespace declarations to store on this element; useful
* during output */
protected transient List additionalNamespaces;
// See http://lists.denveronline.net/lists/jdom-interest/2000-September/003030.html
// for a possible memory optimization here (using a RootElement subclass)
/**
* The attributes of the element. Subclassers have to
* track attributes using their own mechanism.
*/
AttributeList attributes = new AttributeList(this);
/**
* The content of the element. Subclassers have to
* track content using their own mechanism.
*/
ContentList content = new ContentList(this);
/**
* This protected constructor is provided in order to support an Element
* subclass that wants full control over variable initialization. It
* intentionally leaves all instance variables null, allowing a lightweight
* subclass implementation. The subclass is responsible for ensuring all the
* get and set methods on Element behave as documented.
* <p>
* When implementing an Element subclass which doesn't require full control
* over variable initialization, be aware that simply calling super() (or
* letting the compiler add the implicit super() call) will not initialize
* the instance variables which will cause many of the methods to throw a
* NullPointerException. Therefore, the constructor for these subclasses
* should call one of the public constructors so variable initialization is
* handled automatically.
*/
protected Element() { }
/**
* Creates a new element with the supplied (local) name and namespace. If
* the provided namespace is null, the element will have no namespace.
*
* @param name local name of the element
* @param namespace namespace for the element
* @throws IllegalNameException if the given name is illegal as an element
* name
*/
public Element(String name, Namespace namespace) {
setName(name);
setNamespace(namespace);
}
/**
* Create a new element with the supplied (local) name and no namespace.
*
* @param name local name of the element
* @throws IllegalNameException if the given name is illegal as an element
* name.
*/
public Element(String name) {
this(name, (Namespace) null);
}
/**
* Creates a new element with the supplied (local) name and a namespace
* given by a URI. The element will be put into the unprefixed (default)
* namespace.
*
* @param name name of the element
* @param uri namespace URI for the element
* @throws IllegalNameException if the given name is illegal as an element
* name or the given URI is illegal as a
* namespace URI
*/
public Element(String name, String uri) {
this(name, Namespace.getNamespace("", uri));
}
/**
* Creates a new element with the supplied (local) name and a namespace
* given by the supplied prefix and URI combination.
*
* @param name local name of the element
* @param prefix namespace prefix
* @param uri namespace URI for the element
* @throws IllegalNameException if the given name is illegal as an element
* name, the given prefix is illegal as a
* namespace prefix, or the given URI is
* illegal as a namespace URI
*/
public Element(String name, String prefix, String uri) {
this(name, Namespace.getNamespace(prefix, uri));
}
/**
* Returns the (local) name of the element (without any namespace prefix).
*
* @return local element name
*/
public String getName() {
return name;
}
/**
* Sets the (local) name of the element.
*
* @param name the new (local) name of th
没有合适的资源?快使用搜索试试~ 我知道了~
jdom的源代码文档
共68个文件
java:61个
html:7个
需积分: 9 96 下载量 92 浏览量
2008-09-30
01:38:03
上传
评论
收藏 222KB ZIP 举报
温馨提示
以.java形式的文件,在eclipse下可以导入源文件查看源代码。具体操作在构建路径---库
资源推荐
资源详情
资源评论
收起资源包目录
jdom-src.zip (68个子文件)
org
jdom
ContentList.java 36KB
package.html 514B
IllegalDataException.java 5KB
JDOMFactory.java 12KB
Element.java 57KB
DocType.java 9KB
IllegalAddException.java 12KB
FilterIterator.java 4KB
Attribute.java 25KB
AttributeList.java 17KB
UncheckedJDOMFactory.java 7KB
CDATA.java 7KB
transform
package.html 267B
JDOMResult.java 23KB
XSLTransformer.java 10KB
JDOMSource.java 16KB
XSLTransformException.java 3KB
DataConversionException.java 4KB
IllegalNameException.java 5KB
DefaultJDOMFactory.java 7KB
Parent.java 9KB
Document.java 27KB
IllegalTargetException.java 4KB
EntityRef.java 8KB
adapters
package.html 177B
XercesDOMAdapter.java 7KB
CrimsonDOMAdapter.java 6KB
OracleV1DOMAdapter.java 6KB
DOMAdapter.java 5KB
AbstractDOMAdapter.java 7KB
JAXPDOMAdapter.java 8KB
XML4JDOMAdapter.java 7KB
OracleV2DOMAdapter.java 6KB
DescendantIterator.java 6KB
output
package.html 602B
SAXOutputter.java 51KB
Format.java 21KB
EscapeStrategy.java 3KB
DOMOutputter.java 17KB
XMLOutputter.java 57KB
NamespaceStack.java 5KB
JDOMLocator.java 4KB
input
package.html 419B
JAXPParserFactory.java 7KB
SAXHandler.java 34KB
DOMBuilder.java 13KB
BuilderErrorHandler.java 5KB
TextBuffer.java 6KB
JDOMParseException.java 7KB
SAXBuilder.java 36KB
ProcessingInstruction.java 17KB
filter
package.html 351B
AndFilter.java 5KB
AbstractFilter.java 3KB
ElementFilter.java 6KB
OrFilter.java 5KB
Filter.java 3KB
NegateFilter.java 4KB
ContentFilter.java 11KB
Content.java 7KB
Text.java 9KB
Comment.java 5KB
Verifier.java 52KB
JDOMException.java 13KB
Namespace.java 11KB
xpath
package.html 153B
JaxenXPath.java 12KB
XPath.java 17KB
共 68 条
- 1
资源评论
jim1232323
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功