WhitespaceStrippingElementMatcher.java revision 1113:2fdbfbde3bc0
1/*
2 * reserved comment block
3 * DO NOT REMOVE OR ALTER!
4 */
5/*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements.  See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License.  You may obtain a copy of the License at
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22package com.sun.org.apache.xpath.internal;
23
24import javax.xml.transform.TransformerException;
25
26import org.w3c.dom.Element;
27
28/**
29 * A class that implements this interface can tell if a given element should
30 * strip whitespace nodes from it's children.
31 */
32public interface WhitespaceStrippingElementMatcher
33{
34  /**
35   * Get information about whether or not an element should strip whitespace.
36   * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>
37   *
38   * @param support The XPath runtime state.
39   * @param targetElement Element to check
40   *
41   * @return true if the whitespace should be stripped.
42   *
43   * @throws TransformerException
44   */
45  public boolean shouldStripWhiteSpace(
46          XPathContext support, Element targetElement) throws TransformerException;
47
48  /**
49   * Get information about whether or not whitespace can be stripped.
50   * @see <a href="http://www.w3.org/TR/xslt#strip">strip in XSLT Specification</a>
51   *
52   * @return true if the whitespace can be stripped.
53   */
54  public boolean canStripWhiteSpace();
55}
56