KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > n3 > nanoxml > IXMLValidator


1 /* IXMLValidator.java NanoXML/Java
2  *
3  * $Revision: 1421 $
4  * $Date: 2006-03-12 17:32:32 +0100 (Sun, 12 Mar 2006) $
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 import java.util.Properties JavaDoc;
32
33 /**
34  * IXMLValidator processes the DTD and handles entity references.
35  *
36  * @author Marc De Scheemaecker
37  * @version $Name$, $Revision: 1421 $
38  */

39 public interface IXMLValidator
40 {
41
42     /**
43      * Sets the parameter entity resolver.
44      *
45      * @param resolver the entity resolver.
46      */

47     public void setParameterEntityResolver(IXMLEntityResolver resolver);
48
49     /**
50      * Returns the parameter entity resolver.
51      *
52      * @return the entity resolver.
53      */

54     public IXMLEntityResolver getParameterEntityResolver();
55
56     /**
57      * Parses the DTD. The validator object is responsible for reading the full DTD.
58      *
59      * @param publicID the public ID, which may be null.
60      * @param reader the reader to read the DTD from.
61      * @param entityResolver the entity resolver.
62      * @param external true if the DTD is external.
63      *
64      * @throws java.lang.Exception if something went wrong.
65      */

66     public void parseDTD(String JavaDoc publicID, IXMLReader reader, IXMLEntityResolver entityResolver,
67             boolean external) throws Exception JavaDoc;
68
69     /**
70      * Indicates that an element has been started.
71      *
72      * @param name the name of the element.
73      * @param nsPrefix the prefix used to identify the namespace
74      * @param nsSystemId the system ID associated with the namespace
75      * @param systemId the system ID of the XML data of the element.
76      * @param lineNr the line number in the XML data of the element.
77      *
78      * @throws java.lang.Exception if the element could not be validated.
79      */

80     public void elementStarted(String JavaDoc name, String JavaDoc nsPrefix, String JavaDoc nsSystemId, String JavaDoc systemId,
81             int lineNr) throws Exception JavaDoc;
82
83     /**
84      * Indicates that the current element has ended.
85      *
86      * @param name the name of the element.
87      * @param nsPrefix the prefix used to identify the namespace
88      * @param nsSystemId the system ID associated with the namespace
89      * @param systemId the system ID of the XML data of the element.
90      * @param lineNr the line number in the XML data of the element.
91      *
92      * @throws java.lang.Exception if the element could not be validated.
93      */

94     public void elementEnded(String JavaDoc name, String JavaDoc nsPrefix, String JavaDoc nsSystemId, String JavaDoc systemId,
95             int lineNr) throws Exception JavaDoc;
96
97     /**
98      * Indicates that an attribute has been added to the current element.
99      *
100      * @param key the name of the attribute.
101      * @param nsPrefix the prefix used to identify the namespace
102      * @param nsSystemId the system ID associated with the namespace
103      * @param value the value of the attribute.
104      * @param systemId the system ID of the XML data of the element.
105      * @param lineNr the line number in the XML data of the element.
106      *
107      * @throws java.lang.Exception if the attribute could not be validated.
108      */

109     public void attributeAdded(String JavaDoc key, String JavaDoc nsPrefix, String JavaDoc nsSystemId, String JavaDoc value,
110             String JavaDoc systemId, int lineNr) throws Exception JavaDoc;
111
112     /**
113      * This method is called when the attributes of an XML element have been processed. If there are
114      * attributes with a default value which have not been specified yet, they have to be put into
115      * <I>extraAttributes</I>.
116      *
117      * @param name the name of the element.
118      * @param nsPrefix the prefix used to identify the namespace
119      * @param nsSystemId the system ID associated with the namespace
120      * @param extraAttributes where to put extra attributes.
121      * @param systemId the system ID of the XML data of the element.
122      * @param lineNr the line number in the XML data of the element.
123      *
124      * @throws java.lang.Exception if the element could not be validated.
125      */

126     public void elementAttributesProcessed(String JavaDoc name, String JavaDoc nsPrefix, String JavaDoc nsSystemId,
127             Properties JavaDoc extraAttributes, String JavaDoc systemId, int lineNr) throws Exception JavaDoc;
128
129     /**
130      * Indicates that a new #PCDATA element has been encountered.
131      *
132      * @param systemId the system ID of the XML data of the element.
133      * @param lineNr the line number in the XML data of the element.
134      *
135      * @throws java.lang.Exception if the element could not be validated.
136      */

137     public void PCDataAdded(String JavaDoc systemId, int lineNr) throws Exception JavaDoc;
138
139 }
140
Popular Tags