1 | // |
---|
2 | // DeclHandler.h |
---|
3 | // |
---|
4 | // $Id: //poco/1.3/XML/include/Poco/SAX/DeclHandler.h#1 $ |
---|
5 | // |
---|
6 | // Library: XML |
---|
7 | // Package: SAX |
---|
8 | // Module: SAX |
---|
9 | // |
---|
10 | // SAX2-ext DeclHandler Interface. |
---|
11 | // |
---|
12 | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. |
---|
13 | // and Contributors. |
---|
14 | // |
---|
15 | // Permission is hereby granted, free of charge, to any person or organization |
---|
16 | // obtaining a copy of the software and accompanying documentation covered by |
---|
17 | // this license (the "Software") to use, reproduce, display, distribute, |
---|
18 | // execute, and transmit the Software, and to prepare derivative works of the |
---|
19 | // Software, and to permit third-parties to whom the Software is furnished to |
---|
20 | // do so, all subject to the following: |
---|
21 | // |
---|
22 | // The copyright notices in the Software and this entire statement, including |
---|
23 | // the above license grant, this restriction and the following disclaimer, |
---|
24 | // must be included in all copies of the Software, in whole or in part, and |
---|
25 | // all derivative works of the Software, unless such copies or derivative |
---|
26 | // works are solely in the form of machine-executable object code generated by |
---|
27 | // a source language processor. |
---|
28 | // |
---|
29 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
30 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
31 | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT |
---|
32 | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE |
---|
33 | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, |
---|
34 | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
---|
35 | // DEALINGS IN THE SOFTWARE. |
---|
36 | // |
---|
37 | |
---|
38 | |
---|
39 | #ifndef SAX_DeclHandler_INCLUDED |
---|
40 | #define SAX_DeclHandler_INCLUDED |
---|
41 | |
---|
42 | |
---|
43 | #include "Poco/XML/XML.h" |
---|
44 | #include "Poco/XML/XMLString.h" |
---|
45 | |
---|
46 | |
---|
47 | namespace Poco { |
---|
48 | namespace XML { |
---|
49 | |
---|
50 | |
---|
51 | class XML_API DeclHandler |
---|
52 | /// This is an optional extension handler for SAX2 to provide information |
---|
53 | /// about DTD declarations in an XML document. XML |
---|
54 | /// readers are not required to support this handler, and this handler is |
---|
55 | /// not included in the core SAX2 distribution. |
---|
56 | /// |
---|
57 | /// Note that data-related DTD declarations (unparsed entities and notations) |
---|
58 | /// are already reported through the DTDHandler interface. |
---|
59 | /// If you are using the declaration handler together with a lexical handler, |
---|
60 | /// all of the events will occur between the startDTD and the endDTD events. |
---|
61 | /// To set the DeclHandler for an XML reader, use the setProperty method |
---|
62 | /// with the propertyId "http://xml.org/sax/properties/declaration-handler". |
---|
63 | /// If the reader does not support declaration events, it will throw a |
---|
64 | /// SAXNotRecognizedException or a SAXNotSupportedException when you attempt to |
---|
65 | /// register the handler. |
---|
66 | { |
---|
67 | public: |
---|
68 | virtual void attributeDecl(const XMLString& eName, const XMLString& aName, const XMLString* valueDefault, const XMLString* value) = 0; |
---|
69 | /// Report an attribute type declaration. |
---|
70 | /// |
---|
71 | /// Only the effective (first) declaration for an attribute will be reported. |
---|
72 | /// The type will be one of the strings "CDATA", "ID", "IDREF", "IDREFS", |
---|
73 | /// "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES", a parenthesized token group |
---|
74 | /// with the separator "|" and all whitespace removed, or the word "NOTATION" |
---|
75 | /// followed by a space followed by a parenthesized token group with all whitespace |
---|
76 | /// removed. |
---|
77 | /// |
---|
78 | /// The value will be the value as reported to applications, appropriately normalized |
---|
79 | /// and with entity and character references expanded. |
---|
80 | |
---|
81 | virtual void elementDecl(const XMLString& name, const XMLString& model) = 0; |
---|
82 | /// Report an element type declaration. |
---|
83 | /// |
---|
84 | /// The content model will consist of the string "EMPTY", the string "ANY", or a |
---|
85 | /// parenthesised group, optionally followed by an occurrence indicator. The model |
---|
86 | /// will be normalized so that all parameter entities are fully resolved and all |
---|
87 | /// whitespace is removed,and will include the enclosing parentheses. Other |
---|
88 | /// normalization (such as removing redundant parentheses or simplifying occurrence |
---|
89 | /// indicators) is at the discretion of the parser. |
---|
90 | |
---|
91 | virtual void externalEntityDecl(const XMLString& name, const XMLString* publicId, const XMLString& systemId) = 0; |
---|
92 | /// Report an external entity declaration. |
---|
93 | /// |
---|
94 | /// Only the effective (first) declaration for each entity will be reported. |
---|
95 | /// |
---|
96 | /// If the system identifier is a URL, the parser must resolve it fully before |
---|
97 | /// passing it to the application. |
---|
98 | |
---|
99 | virtual void internalEntityDecl(const XMLString& name, const XMLString& value) = 0; |
---|
100 | /// Report an internal entity declaration. |
---|
101 | /// |
---|
102 | /// Only the effective (first) declaration for each entity will be reported. All |
---|
103 | /// parameter entities in the value will be expanded, but general entities will not. |
---|
104 | |
---|
105 | protected: |
---|
106 | virtual ~DeclHandler(); |
---|
107 | }; |
---|
108 | |
---|
109 | |
---|
110 | } } // namespace Poco::XML |
---|
111 | |
---|
112 | |
---|
113 | #endif // SAX_DeclHandler_INCLUDED |
---|