root / trunk / build / distribution / IzPack / src / lib / net / n3 / nanoxml / IXMLValidator.java @ 21757
History | View | Annotate | Download (6.5 KB)
1 |
/* IXMLValidator.java NanoXML/Java
|
---|---|
2 |
*
|
3 |
* $Revision: 5819 $
|
4 |
* $Date: 2006-06-14 09:29:09 +0200 $
|
5 |
* $Name$
|
6 |
*
|
7 |
* This file is part of NanoXML 2 for Java.
|
8 |
* Copyright (C) 2001 Marc De Scheemaecker, All Rights Reserved.
|
9 |
*
|
10 |
* This software is provided 'as-is', without any express or implied warranty.
|
11 |
* In no event will the authors be held liable for any damages arising from the
|
12 |
* use of this software.
|
13 |
*
|
14 |
* Permission is granted to anyone to use this software for any purpose,
|
15 |
* including commercial applications, and to alter it and redistribute it
|
16 |
* freely, subject to the following restrictions:
|
17 |
*
|
18 |
* 1. The origin of this software must not be misrepresented; you must not
|
19 |
* claim that you wrote the original software. If you use this software in
|
20 |
* a product, an acknowledgment in the product documentation would be
|
21 |
* appreciated but is not required.
|
22 |
*
|
23 |
* 2. Altered source versions must be plainly marked as such, and must not be
|
24 |
* misrepresented as being the original software.
|
25 |
*
|
26 |
* 3. This notice may not be removed or altered from any source distribution.
|
27 |
*/
|
28 |
|
29 |
package net.n3.nanoxml; |
30 |
|
31 |
|
32 |
import java.util.Properties; |
33 |
|
34 |
|
35 |
/**
|
36 |
* IXMLValidator processes the DTD and handles entity references.
|
37 |
*
|
38 |
* @author Marc De Scheemaecker
|
39 |
* @version $Name$, $Revision: 5819 $
|
40 |
*/
|
41 |
public interface IXMLValidator |
42 |
{ |
43 |
|
44 |
/**
|
45 |
* Sets the parameter entity resolver.
|
46 |
*
|
47 |
* @param resolver the entity resolver.
|
48 |
*/
|
49 |
public void setParameterEntityResolver(IXMLEntityResolver resolver); |
50 |
|
51 |
|
52 |
/**
|
53 |
* Returns the parameter entity resolver.
|
54 |
*
|
55 |
* @return the entity resolver.
|
56 |
*/
|
57 |
public IXMLEntityResolver getParameterEntityResolver();
|
58 |
|
59 |
|
60 |
/**
|
61 |
* Parses the DTD. The validator object is responsible for reading the
|
62 |
* full DTD.
|
63 |
*
|
64 |
* @param publicID the public ID, which may be null.
|
65 |
* @param reader the reader to read the DTD from.
|
66 |
* @param entityResolver the entity resolver.
|
67 |
* @param external true if the DTD is external.
|
68 |
*
|
69 |
* @throws java.lang.Exception
|
70 |
* if something went wrong.
|
71 |
*/
|
72 |
public void parseDTD(String publicID, |
73 |
IXMLReader reader, |
74 |
IXMLEntityResolver entityResolver, |
75 |
boolean external)
|
76 |
throws Exception; |
77 |
|
78 |
|
79 |
/**
|
80 |
* Indicates that an element has been started.
|
81 |
*
|
82 |
* @param name the name of the element.
|
83 |
* @param nsPrefix the prefix used to identify the namespace
|
84 |
* @param nsSystemId the system ID associated with the namespace
|
85 |
* @param systemId the system ID of the XML data of the element.
|
86 |
* @param lineNr the line number in the XML data of the element.
|
87 |
*
|
88 |
* @throws java.lang.Exception
|
89 |
* if the element could not be validated.
|
90 |
*/
|
91 |
public void elementStarted(String name, |
92 |
String nsPrefix,
|
93 |
String nsSystemId,
|
94 |
String systemId,
|
95 |
int lineNr)
|
96 |
throws Exception; |
97 |
|
98 |
|
99 |
/**
|
100 |
* Indicates that the current element has ended.
|
101 |
*
|
102 |
* @param name the name of the element.
|
103 |
* @param nsPrefix the prefix used to identify the namespace
|
104 |
* @param nsSystemId the system ID associated with the namespace
|
105 |
* @param systemId the system ID of the XML data of the element.
|
106 |
* @param lineNr the line number in the XML data of the element.
|
107 |
*
|
108 |
* @throws java.lang.Exception
|
109 |
* if the element could not be validated.
|
110 |
*/
|
111 |
public void elementEnded(String name, |
112 |
String nsPrefix,
|
113 |
String nsSystemId,
|
114 |
String systemId,
|
115 |
int lineNr)
|
116 |
throws Exception; |
117 |
|
118 |
|
119 |
/**
|
120 |
* Indicates that an attribute has been added to the current element.
|
121 |
*
|
122 |
* @param key the name of the attribute.
|
123 |
* @param nsPrefix the prefix used to identify the namespace
|
124 |
* @param nsSystemId the system ID associated with the namespace
|
125 |
* @param value the value of the attribute.
|
126 |
* @param systemId the system ID of the XML data of the element.
|
127 |
* @param lineNr the line number in the XML data of the element.
|
128 |
*
|
129 |
* @throws java.lang.Exception
|
130 |
* if the attribute could not be validated.
|
131 |
*/
|
132 |
public void attributeAdded(String key, |
133 |
String nsPrefix,
|
134 |
String nsSystemId,
|
135 |
String value,
|
136 |
String systemId,
|
137 |
int lineNr)
|
138 |
throws Exception; |
139 |
|
140 |
|
141 |
/**
|
142 |
* This method is called when the attributes of an XML element have been
|
143 |
* processed.
|
144 |
* If there are attributes with a default value which have not been
|
145 |
* specified yet, they have to be put into <I>extraAttributes</I>.
|
146 |
*
|
147 |
* @param name the name of the element.
|
148 |
* @param nsPrefix the prefix used to identify the namespace
|
149 |
* @param nsSystemId the system ID associated with the namespace
|
150 |
* @param extraAttributes where to put extra attributes.
|
151 |
* @param systemId the system ID of the XML data of the element.
|
152 |
* @param lineNr the line number in the XML data of the element.
|
153 |
*
|
154 |
* @throws java.lang.Exception
|
155 |
* if the element could not be validated.
|
156 |
*/
|
157 |
public void elementAttributesProcessed(String name, |
158 |
String nsPrefix,
|
159 |
String nsSystemId,
|
160 |
Properties extraAttributes,
|
161 |
String systemId,
|
162 |
int lineNr)
|
163 |
throws Exception; |
164 |
|
165 |
|
166 |
/**
|
167 |
* Indicates that a new #PCDATA element has been encountered.
|
168 |
*
|
169 |
* @param systemId the system ID of the XML data of the element.
|
170 |
* @param lineNr the line number in the XML data of the element.
|
171 |
*
|
172 |
* @throws java.lang.Exception
|
173 |
* if the element could not be validated.
|
174 |
*/
|
175 |
public void PCDataAdded(String systemId, |
176 |
int lineNr)
|
177 |
throws Exception; |
178 |
|
179 |
} |