001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements. See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership. The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the  "License");
007     * you may not use this file except in compliance with the License.
008     * You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing, software
013     * distributed under the License is distributed on an "AS IS" BASIS,
014     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015     * See the License for the specific language governing permissions and
016     * limitations under the License.
017     */
018    /*
019     * $Id: WhitespaceStrippingElementMatcher.java 468655 2006-10-28 07:12:06Z minchau $
020     */
021    package org.apache.xpath;
022    
023    import javax.xml.transform.TransformerException;
024    
025    import org.w3c.dom.Element;
026    
027    /**
028     * A class that implements this interface can tell if a given element should 
029     * strip whitespace nodes from it's children.
030     */
031    public interface WhitespaceStrippingElementMatcher
032    {
033      /**
034       * Get information about whether or not an element should strip whitespace.
035       * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>
036       *
037       * @param support The XPath runtime state.
038       * @param targetElement Element to check
039       *
040       * @return true if the whitespace should be stripped.
041       *
042       * @throws TransformerException
043       */
044      public boolean shouldStripWhiteSpace(
045              XPathContext support, Element targetElement) throws TransformerException;
046      
047      /**
048       * Get information about whether or not whitespace can be stripped.
049       * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>
050       *
051       * @return true if the whitespace can be stripped.
052       */
053      public boolean canStripWhiteSpace();
054    }