KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jahia > clipbuilder > html > web > html > Impl > HTMLParser > HTMLParserDocument


1 package org.jahia.clipbuilder.html.web.html.Impl.HTMLParser;
2 import java.util.*;
3
4 import org.jahia.clipbuilder.html.bean.*;
5 import org.jahia.clipbuilder.html.web.html.*;
6
7 /**
8  * Implementation of HTMLDocument interface based on org.htmlparser.* package
9  *
10  *@author Tlili Khaled
11  */

12 public class HTMLParserDocument implements HTMLDocument {
13
14     private UrlBean urlBean;
15     private String JavaDoc originalHtml;
16     private String JavaDoc transformedDocument;
17     private String JavaDoc chewDocument;
18     private String JavaDoc documentWhithLabel;
19     private List framesList;
20     private HTMLParserTransformer transformer;
21     private String JavaDoc userDocument;
22     private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(HTMLParserDocument.class);
23
24
25     /**
26      * Constructor for the HTMLParserDocument object
27      *
28      *@param urlBean Description of Parameter
29      *@param originalHtml Description of Parameter
30      */

31     public HTMLParserDocument(UrlBean urlBean, String JavaDoc originalHtml) {
32         setUrlBean(urlBean);
33         this.originalHtml = originalHtml;
34     }
35
36
37     /**
38      * Sets the UrlBean attribute of the HTMLDocument object
39      *
40      *@param urlBean The new UrlBean value
41      */

42     public void setUrlBean(UrlBean urlBean) {
43         this.urlBean = urlBean;
44     }
45
46
47     /**
48      * Sets the Transformer attribute of the HTMLParserDocument object
49      *
50      *@param transformer The new Transformer value
51      */

52     public void setTransformer(HTMLParserTransformer transformer) {
53         this.transformer = transformer;
54     }
55
56
57     /**
58      * Sets the TransformedDocument attribute of the HTMLParserDocument object
59      *
60      *@param transformedDocument The new TransformedDocument value
61      */

62     public void setTransformedDocument(String JavaDoc transformedDocument) {
63         this.transformedDocument = transformedDocument;
64     }
65
66
67     /**
68      * Sets the ChewDocument attribute of the HTMLParserDocument object
69      *
70      *@param chewDocument The new ChewDocument value
71      */

72     public void setChewDocument(String JavaDoc chewDocument) {
73         this.chewDocument = chewDocument;
74     }
75
76
77     /**
78      * Sets the DocumentWhithLabel attribute of the HTMLParserDocument object
79      *
80      *@param documentWhithLabel The new DocumentWhithLabel value
81      */

82     public void setDocumentWhithLabel(String JavaDoc documentWhithLabel) {
83         this.documentWhithLabel = documentWhithLabel;
84     }
85
86
87     /**
88      * Sets the UserDocument attribute of the HTMLParserDocument object
89      *
90      *@param userDocument The new UserDocument value
91      */

92     public void setUserDocument(String JavaDoc userDocument) {
93         this.userDocument = userDocument;
94     }
95
96
97     /**
98      * Sets the FramesList attribute of the HTMLParserDocument object
99      *
100      *@param framesList The new FramesList value
101      */

102     public void setFramesList(List framesList) {
103         this.framesList = framesList;
104     }
105
106
107
108     /**
109      * Gets the ChewDocumentAsString attribute of the HTMLDocument object
110      *
111      *@param tagName Description of Parameter
112      *@return The ChewDocumentAsString value
113      */

114     public String JavaDoc getChewDocumentAsString(String JavaDoc tagName) {
115         getTransformer().buildChewDocument(tagName);
116         return getDocumentAsString(getChewDocument());
117     }
118
119
120     /**
121      * Gets the DocumentWhithParamLabelAsString attribute of the HTMLDocument
122      * object
123      *
124      *@return The DocumentWhithParamLabelAsString value
125      */

126     public String JavaDoc getDocumentWhithParamLabelAsString() {
127         if (getDocumentWhithLabel() == null) {
128             getTransformer().buildDocumentWhithLabel();
129         }
130         return getDocumentAsString(getDocumentWhithLabel());
131     }
132
133
134     /**
135      * Gets the UserDocumentAsString attribute of the HTMLParserDocument object
136      *
137      *@return The UserDocumentAsString value
138      */

139     public String JavaDoc getUserDocumentAsString() {
140         if (getUserDocument() == null) {
141             getTransformer().buildUserDocument();
142         }
143         return getDocumentAsString(getUserDocument());
144     }
145
146
147
148     /**
149      * Gets the OriginalDocumentAsString attribute of the HTMLDocument object
150      *
151      *@return The OriginalDocumentAsString value
152      */

153     public String JavaDoc getOriginalDocumentAsString() {
154         return originalHtml;
155     }
156
157
158
159     /**
160      * Gets the TransformationErrors attribute of the HTMLParserDocument object
161      *
162      *@return The TransformationErrors value
163      */

164     public java.util.List JavaDoc getTransformationErrors() {
165         return getTransformer().getLastParsingErrors();
166     }
167
168
169
170     /**
171      * Gets the Transformer attribute of the HTMLParserDocument object
172      *
173      *@return The Transformer value
174      */

175     public HTMLTransformer getTransformer() {
176         return this.transformer;
177     }
178
179
180     /**
181      * Gets the TransformedDocument attribute of the HTMLParserDocument object
182      *
183      *@return The TransformedDocument value
184      */

185     public String JavaDoc getTransformedDocument() {
186         return transformedDocument;
187     }
188
189
190     /**
191      * Gets the ChewDocument attribute of the HTMLParserDocument object
192      *
193      *@return The ChewDocument value
194      */

195     public String JavaDoc getChewDocument() {
196         return this.chewDocument;
197     }
198
199
200     /**
201      * Gets the DocumentWhithLabel attribute of the HTMLParserDocument object
202      *
203      *@return The DocumentWhithLabel value
204      */

205     public String JavaDoc getDocumentWhithLabel() {
206         return documentWhithLabel;
207     }
208
209
210     /**
211      * Gets the TransformedDocumentAsString attribute of the HTMLDocument object
212      *
213      *@return The TransformedDocumentAsString value
214      */

215     public String JavaDoc getTransformedDocumentAsString() {
216         if (getTransformedDocument() == null) {
217             getTransformer().buildTransformedDocument();
218         }
219         return getDocumentAsString(getTransformedDocument());
220     }
221
222
223
224     /**
225      * Gets the UrlBean attribute of the HTMLDocument object
226      *
227      *@return The UrlBean value
228      */

229     public UrlBean getUrlBean() {
230         return this.urlBean;
231     }
232
233
234     /**
235      * Gets the UserDocument attribute of the HTMLParserDocument object
236      *
237      *@return The UserDocument value
238      */

239     public String JavaDoc getUserDocument() {
240         return userDocument;
241     }
242
243
244
245
246
247     /**
248      * Gets the FramesList attribute of the HTMLParserDocument object
249      *
250      *@return The FramesList value
251      */

252     public List getFramesList() {
253         return framesList;
254     }
255
256
257     /**
258      * Gets the DocumentAsString attribute of the HTMLParserDocument object
259      *
260      *@param html Description of Parameter
261      *@return The DocumentAsString value
262      */

263     private String JavaDoc getDocumentAsString(String JavaDoc html) {
264         return html;
265     }
266
267 }
268
Popular Tags