1. /*
  2. * Copyright (c) 2000 World Wide Web Consortium,
  3. * (Massachusetts Institute of Technology, Institut National de
  4. * Recherche en Informatique et en Automatique, Keio University). All
  5. * Rights Reserved. This program is distributed under the W3C's Software
  6. * Intellectual Property License. This program is distributed in the
  7. * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
  8. * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  9. * PURPOSE.
  10. * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
  11. */
  12. package org.w3c.dom;
  13. /**
  14. * <code>DocumentFragment</code> is a "lightweight" or "minimal"
  15. * <code>Document</code> object. It is very common to want to be able to
  16. * extract a portion of a document's tree or to create a new fragment of a
  17. * document. Imagine implementing a user command like cut or rearranging a
  18. * document by moving fragments around. It is desirable to have an object
  19. * which can hold such fragments and it is quite natural to use a Node for
  20. * this purpose. While it is true that a <code>Document</code> object could
  21. * fulfill this role, a <code>Document</code> object can potentially be a
  22. * heavyweight object, depending on the underlying implementation. What is
  23. * really needed for this is a very lightweight object.
  24. * <code>DocumentFragment</code> is such an object.
  25. * <p>Furthermore, various operations -- such as inserting nodes as children
  26. * of another <code>Node</code> -- may take <code>DocumentFragment</code>
  27. * objects as arguments; this results in all the child nodes of the
  28. * <code>DocumentFragment</code> being moved to the child list of this node.
  29. * <p>The children of a <code>DocumentFragment</code> node are zero or more
  30. * nodes representing the tops of any sub-trees defining the structure of
  31. * the document. <code>DocumentFragment</code> nodes do not need to be
  32. * well-formed XML documents (although they do need to follow the rules
  33. * imposed upon well-formed XML parsed entities, which can have multiple top
  34. * nodes). For example, a <code>DocumentFragment</code> might have only one
  35. * child and that child node could be a <code>Text</code> node. Such a
  36. * structure model represents neither an HTML document nor a well-formed XML
  37. * document.
  38. * <p>When a <code>DocumentFragment</code> is inserted into a
  39. * <code>Document</code> (or indeed any other <code>Node</code> that may
  40. * take children) the children of the <code>DocumentFragment</code> and not
  41. * the <code>DocumentFragment</code> itself are inserted into the
  42. * <code>Node</code>. This makes the <code>DocumentFragment</code> very
  43. * useful when the user wishes to create nodes that are siblings; the
  44. * <code>DocumentFragment</code> acts as the parent of these nodes so that
  45. * the user can use the standard methods from the <code>Node</code>
  46. * interface, such as <code>insertBefore</code> and <code>appendChild</code>.
  47. * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
  48. */
  49. public interface DocumentFragment extends Node {
  50. }