1320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson/* 2320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Copyright (c) 2004 World Wide Web Consortium, 3320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * 4320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * (Massachusetts Institute of Technology, European Research Consortium for 5320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * Informatics and Mathematics, Keio University). All Rights Reserved. This 6320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * work is distributed under the W3C(r) Software License [1] in the hope that 7320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * it will be useful, but WITHOUT ANY WARRANTY; without even the implied 8320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 9320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * 10320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 11320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 12320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 13320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilsonpackage org.w3c.dom.ls; 14320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 15320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilsonimport org.w3c.dom.traversal.NodeFilter; 16320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 17320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson/** 18f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSSerializerFilter</code>s provide applications the ability to 19f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * examine nodes as they are being serialized and decide what nodes should 20f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * be serialized or not. The <code>LSSerializerFilter</code> interface is 21320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * based on the <code>NodeFilter</code> interface defined in [<a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>DOM Level 2 Traversal and Range</a>] 22f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * . 23f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p> <code>Document</code>, <code>DocumentType</code>, 24320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <code>DocumentFragment</code>, <code>Notation</code>, <code>Entity</code> 25f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * , and children of <code>Attr</code> nodes are not passed to the filter. 26f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * The child nodes of an <code>EntityReference</code> node are only passed 27f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * to the filter if the <code>EntityReference</code> node is skipped by the 28f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * method <code>LSParserFilter.acceptNode()</code>. 29f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p> When serializing an <code>Element</code>, the element is passed to the 30f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * filter before any of its attributes are passed to the filter. Namespace 31320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * declaration attributes, and default attributes (except in the case when " 32f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * discard-default-content" is set to <code>false</code>), are never passed 33f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * to the filter. 34f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p> The result of any attempt to modify a node passed to a 35f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSSerializerFilter</code> is implementation dependent. 36f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p> DOM applications must not raise exceptions in a filter. The effect of 37f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * throwing exceptions from a filter is DOM implementation dependent. 38f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <p> For efficiency, a node passed to the filter may not be the same as the 39f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * one that is actually in the tree. And the actual node (node object 40f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * identity) may be reused during the process of filtering and serializing a 41f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * document. 42320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <p>See also the <a href='http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407'>Document Object Model (DOM) Level 3 Load 43320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilsonand Save Specification</a>. 440233201f5e7de490d3830ca96e8a18765797ea3aJesse Wilson * 450233201f5e7de490d3830ca96e8a18765797ea3aJesse Wilson * @hide 46320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 47320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilsonpublic interface LSSerializerFilter extends NodeFilter { 48320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson /** 49f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * Tells the <code>LSSerializer</code> what types of nodes to show to the 50f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * filter. If a node is not shown to the filter using this attribute, it 51f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * is automatically serialized. See <code>NodeFilter</code> for 52320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * definition of the constants. The constants <code>SHOW_DOCUMENT</code> 53320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * , <code>SHOW_DOCUMENT_TYPE</code>, <code>SHOW_DOCUMENT_FRAGMENT</code> 54f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * , <code>SHOW_NOTATION</code>, and <code>SHOW_ENTITY</code> are 55f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * meaningless here, such nodes will never be passed to a 56f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>LSSerializerFilter</code>. 57320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <br> Unlike [<a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>DOM Level 2 Traversal and Range</a>] 58f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * , the <code>SHOW_ATTRIBUTE</code> constant indicates that the 59f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * <code>Attr</code> nodes are shown and passed to the filter. 60320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson * <br> The constants used here are defined in [<a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>DOM Level 2 Traversal and Range</a>] 61f33eae7e84eb6d3b0f4e86b59605bb3de73009f3Elliott Hughes * . 62320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson */ 63320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson public int getWhatToShow(); 64320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson 65320c9890e8241fb0ad05de6fa5e6c3eb3aece159Jesse Wilson} 66