286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 286N/A * This code is free software; you can redistribute it and/or modify it 286N/A * under the terms of the GNU General Public License version 2 only, as 286N/A * published by the Free Software Foundation. Oracle designates this 286N/A * particular file as subject to the "Classpath" exception as provided 286N/A * by Oracle in the LICENSE file that accompanied this code. 286N/A * This code is distributed in the hope that it will be useful, but WITHOUT 286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 286N/A * version 2 for more details (a copy is included in the LICENSE file that 286N/A * accompanied this code). 286N/A * You should have received a copy of the GNU General Public License version 286N/A * 2 along with this work; if not, write to the Free Software Foundation, 286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 286N/A * or visit www.oracle.com if you need additional information or have any 286N/A * This file is available under and governed by the GNU General Public 286N/A * License version 2 only, as published by the Free Software Foundation. 286N/A * However, the following notice accompanied the original version of this 286N/A * file and, per its terms, should not be removed: 286N/A * Copyright (c) 2004 World Wide Web Consortium, 286N/A * (Massachusetts Institute of Technology, European Research Consortium for 286N/A * Informatics and Mathematics, Keio University). All Rights Reserved. This 286N/A * work is distributed under the W3C(r) Software License [1] in the hope that 286N/A * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 286N/A * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 286N/A * <code>DocumentFragment</code> is a "lightweight" or "minimal" 286N/A * <code>Document</code> object. It is very common to want to be able to 286N/A * extract a portion of a document's tree or to create a new fragment of a 286N/A * document. Imagine implementing a user command like cut or rearranging a 286N/A * document by moving fragments around. It is desirable to have an object 286N/A * which can hold such fragments and it is quite natural to use a Node for 286N/A * this purpose. While it is true that a <code>Document</code> object could 286N/A * fulfill this role, a <code>Document</code> object can potentially be a 286N/A * heavyweight object, depending on the underlying implementation. What is 286N/A * really needed for this is a very lightweight object. 286N/A * <code>DocumentFragment</code> is such an object. 286N/A * <p>Furthermore, various operations -- such as inserting nodes as children 286N/A * of another <code>Node</code> -- may take <code>DocumentFragment</code> 286N/A * objects as arguments; this results in all the child nodes of the 286N/A * <code>DocumentFragment</code> being moved to the child list of this node. 286N/A * <p>The children of a <code>DocumentFragment</code> node are zero or more 286N/A * nodes representing the tops of any sub-trees defining the structure of 286N/A * the document. <code>DocumentFragment</code> nodes do not need to be 286N/A * well-formed XML documents (although they do need to follow the rules 286N/A * imposed upon well-formed XML parsed entities, which can have multiple top 286N/A * nodes). For example, a <code>DocumentFragment</code> might have only one 286N/A * child and that child node could be a <code>Text</code> node. Such a 286N/A * structure model represents neither an HTML document nor a well-formed XML 286N/A * <p>When a <code>DocumentFragment</code> is inserted into a 286N/A * <code>Document</code> (or indeed any other <code>Node</code> that may 286N/A * take children) the children of the <code>DocumentFragment</code> and not 286N/A * the <code>DocumentFragment</code> itself are inserted into the 286N/A * <code>Node</code>. This makes the <code>DocumentFragment</code> very 286N/A * useful when the user wishes to create nodes that are siblings; the 286N/A * <code>DocumentFragment</code> acts as the parent of these nodes so that 286N/A * the user can use the standard methods from the <code>Node</code> 286N/A * interface, such as <code>Node.insertBefore</code> and 286N/A * <code>Node.appendChild</code>.