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: Document.java,v 1.7 2001/06/20 18:59:23 jstrachan Exp $
008 */
009
010package org.dom4j;
011
012import java.util.Map;
013
014import org.xml.sax.EntityResolver;
015
016/** <p><code>Document</code> defines an XML Document.</p>
017  *
018  * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
019  * @version $Revision: 1.7 $
020  */
021public interface Document extends Branch {
022
023    /** Returns the root {@link Element} for this document.
024      *
025      * @return the root element for this document
026      */
027    public Element getRootElement();
028    
029    /** Sets the root element for this document
030      *
031      * @param rootElement the new root element for this document
032      */    
033    public void setRootElement(Element rootElement);
034
035    
036    /** Adds a new <code>Comment</code> node with the given text to this branch.
037      *
038      * @param comment is the text for the <code>Comment</code> node.
039      * @return this <code>Document</code> instance.
040      */    
041    public Document addComment(String comment);
042
043    /** Adds a processing instruction for the given target
044      *
045      * @param target is the target of the processing instruction
046      * @param text is the textual data (key/value pairs) of the processing instruction
047      * @return this <code>Document</code> instance.
048      */
049    public Document addProcessingInstruction(String target, String text);
050    
051    /** Adds a processing instruction for the given target
052      *
053      * @param target is the target of the processing instruction
054      * @param data is a Map of the key / value pairs of the processing instruction
055      * @return this <code>Document</code> instance.
056      */
057    public Document addProcessingInstruction(String target, Map data);
058    
059    /** Adds a DOCTYPE declaration to this document
060      *
061      * @param name is the name of the root element
062      * @param publicId is the PUBLIC URI
063      * @param systemId is the SYSTEM URI
064      * @return this <code>Document</co`de> instance.
065      */
066    public Document addDocType(String name, String publicId, String systemId);    
067
068    
069
070    /** @return the DocumentType property 
071      */
072    public DocumentType getDocType();
073    
074    /** Sets the DocumentType property
075      */
076    public void setDocType(DocumentType docType);
077    
078    
079    /** @return the EntityResolver used to find resolve URIs such as for DTDs,
080      * or XML Schema documents 
081      */
082    public EntityResolver getEntityResolver();
083    
084    /** Sets the EntityResolver used to find resolve URIs such as for DTDs,
085      * or XML Schema documents 
086      */
087    public void setEntityResolver(EntityResolver entityResolver);
088    
089}
090
091
092
093
094
095
096
097/*
098 * Redistribution and use of this software and associated documentation
099 * ("Software"), with or without modification, are permitted provided
100 * that the following conditions are met:
101 *
102 * 1. Redistributions of source code must retain copyright
103 *    statements and notices.  Redistributions must also contain a
104 *    copy of this document.
105 *
106 * 2. Redistributions in binary form must reproduce the
107 *    above copyright notice, this list of conditions and the
108 *    following disclaimer in the documentation and/or other
109 *    materials provided with the distribution.
110 *
111 * 3. The name "DOM4J" must not be used to endorse or promote
112 *    products derived from this Software without prior written
113 *    permission of MetaStuff, Ltd.  For written permission,
114 *    please contact dom4j-info@metastuff.com.
115 *
116 * 4. Products derived from this Software may not be called "DOM4J"
117 *    nor may "DOM4J" appear in their names without prior written
118 *    permission of MetaStuff, Ltd. DOM4J is a registered
119 *    trademark of MetaStuff, Ltd.
120 *
121 * 5. Due credit should be given to the DOM4J Project
122 *    (http://dom4j.org/).
123 *
124 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS
125 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
126 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
127 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
128 * METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
129 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
130 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
131 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
132 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
133 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
134 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
135 * OF THE POSSIBILITY OF SUCH DAMAGE.
136 *
137 * Copyright 2001 (C) MetaStuff, Ltd. All Rights Reserved.
138 *
139 * $Id: Document.java,v 1.7 2001/06/20 18:59:23 jstrachan Exp $
140 */