KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xalan > templates > WhiteSpaceInfo


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 /*
17  * $Id: WhiteSpaceInfo.java,v 1.10 2004/02/16 20:32:33 minchau Exp $
18  */

19 package org.apache.xalan.templates;
20
21 import org.apache.xpath.XPath;
22
23 /**
24  * This is used as a special "fake" template that can be
25  * handled by the TemplateList to do pattern matching
26  * on nodes.
27  */

28 public class WhiteSpaceInfo extends ElemTemplate
29 {
30
31   /** Flag indicating whether whitespaces should be stripped.
32    * @serial */

33   private boolean m_shouldStripSpace;
34
35   /**
36    * Return true if this element specifies that the node that
37    * matches the match pattern should be stripped, otherwise
38    * the space should be preserved.
39    *
40    * @return value of m_shouldStripSpace flag
41    */

42   public boolean getShouldStripSpace()
43   {
44     return m_shouldStripSpace;
45   }
46   
47   /**
48    * Constructor WhiteSpaceInfo
49    *
50    *
51    * @param matchPattern Match pattern
52    * @param shouldStripSpace Flag indicating whether or not
53    * to strip whitespaces
54    * @param thisSheet The current stylesheet
55    */

56   public WhiteSpaceInfo(Stylesheet thisSheet)
57   {
58     setStylesheet(thisSheet);
59   }
60
61
62   /**
63    * Constructor WhiteSpaceInfo
64    *
65    *
66    * @param matchPattern Match pattern
67    * @param shouldStripSpace Flag indicating whether or not
68    * to strip whitespaces
69    * @param thisSheet The current stylesheet
70    */

71   public WhiteSpaceInfo(XPath matchPattern, boolean shouldStripSpace, Stylesheet thisSheet)
72   {
73
74     m_shouldStripSpace = shouldStripSpace;
75
76     setMatch(matchPattern);
77
78     setStylesheet(thisSheet);
79   }
80
81   /**
82    * This function is called to recompose() all of the WhiteSpaceInfo elements.
83    */

84   public void recompose(StylesheetRoot root)
85   {
86     root.recomposeWhiteSpaceInfo(this);
87   }
88
89 }
90
Popular Tags