blob: 9f3039aa6a489a4f9025e568108faa1fc9877ab7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
/*******************************************************************************
* Copyright (c) 2001, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
* Jens Lukowski/Innoopract - initial renaming/restructuring
*
*******************************************************************************/
package org.eclipse.wst.xml.core.commentelement;
import org.eclipse.wst.xml.core.document.IDOMElement;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
*/
public interface CommentElementHandler {
/**
* This method is called when the prefix of the comment content matches
* the string specified in <startswith prefix=""/> in plugin
* extension. Comment content is parsed and new DOM element is created in
* this method. Implementor has to do following:
* <li>For start tag :
* <ul>
* <li>parse comment content and create new element instance.</li>
* </ul>
* </li>
* <li>For end tag :
* <ul>
* <li>parse comment content and create new element instance.</li>
* <li>make isEndTag flag true.</li>
* <li>Parser framework searches mached start tag element instance after
* this createElement call, and new instance is just thrown away.</li>
* </ul>
* </li>
* <li>For empty tag :
* <ul>
* <li>parse comment content and create new element instance.</li>
* <li>make isEndTag flag true.</li>
* </ul>
* </li>
*
* @param document
* parent DOM document
* @param data
* comment content. comment prefix (<!-- or <%--), suffix
* (--> or --%>), and surrounding spaces are trimmed.
* @param isJSPTag
* true if the comment is JSP style comment. This information
* may be required by handler when the handler accepts both XML
* style and JSP style comment (namely,
* commenttype="both" in plugin.xml).
* @return comment element instance if the comment content is rightly
* parsed. if parse failed, returns null.
*/
Element createElement(Document document, String data, boolean isJSPTag);
/**
* This method generates the source text of the end tag for the passed
* element. Do not generate comment prefix (<!-- or <%--) and suffix
* (--> or --%>). XMLGenerator uses this method to generate XML/HTML
* source for a comment element.
*
* @param element
* the comment element
* @return generated tag string
*/
String generateEndTagContent(IDOMElement element);
/**
* This method generates the source text of the start tag for the passed
* element. Do not generate comment prefix (<!-- or <%--) and suffix
* (--> or --%>). XMLGenerator uses this method to generate XML/HTML
* source for a comment element.
*
* @param element
* the comment element
* @return generated tag string
*/
String generateStartTagContent(IDOMElement element);
/**
*
* @param element
* the element
* @return boolean whether the element is comment element or not
*/
boolean isCommentElement(IDOMElement element);
/**
*
* @return boolean whether this element can have children or not
*/
boolean isEmpty();
/**
* @return String
*/
// String getElementPrefix();
}
|