root / trunk / tbeta / Linux / libs / poco / include / Poco / SAX / LexicalHandler.h @ 164
View | Annotate | Download (6.4 KB)
| 1 | 164 | ss | //
|
|---|---|---|---|
| 2 | 164 | ss | // LexicalHandler.h
|
| 3 | 164 | ss | //
|
| 4 | 164 | ss | // $Id: //poco/1.3/XML/include/Poco/SAX/LexicalHandler.h#1 $
|
| 5 | 164 | ss | //
|
| 6 | 164 | ss | // Library: XML
|
| 7 | 164 | ss | // Package: SAX
|
| 8 | 164 | ss | // Module: SAX
|
| 9 | 164 | ss | //
|
| 10 | 164 | ss | // SAX2-ext LexicalHandler Interface.
|
| 11 | 164 | ss | //
|
| 12 | 164 | ss | // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
|
| 13 | 164 | ss | // and Contributors.
|
| 14 | 164 | ss | //
|
| 15 | 164 | ss | // Permission is hereby granted, free of charge, to any person or organization
|
| 16 | 164 | ss | // obtaining a copy of the software and accompanying documentation covered by
|
| 17 | 164 | ss | // this license (the "Software") to use, reproduce, display, distribute,
|
| 18 | 164 | ss | // execute, and transmit the Software, and to prepare derivative works of the
|
| 19 | 164 | ss | // Software, and to permit third-parties to whom the Software is furnished to
|
| 20 | 164 | ss | // do so, all subject to the following:
|
| 21 | 164 | ss | //
|
| 22 | 164 | ss | // The copyright notices in the Software and this entire statement, including
|
| 23 | 164 | ss | // the above license grant, this restriction and the following disclaimer,
|
| 24 | 164 | ss | // must be included in all copies of the Software, in whole or in part, and
|
| 25 | 164 | ss | // all derivative works of the Software, unless such copies or derivative
|
| 26 | 164 | ss | // works are solely in the form of machine-executable object code generated by
|
| 27 | 164 | ss | // a source language processor.
|
| 28 | 164 | ss | //
|
| 29 | 164 | ss | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
| 30 | 164 | ss | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
| 31 | 164 | ss | // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
| 32 | 164 | ss | // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
| 33 | 164 | ss | // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
| 34 | 164 | ss | // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
| 35 | 164 | ss | // DEALINGS IN THE SOFTWARE.
|
| 36 | 164 | ss | //
|
| 37 | 164 | ss | |
| 38 | 164 | ss | |
| 39 | 164 | ss | #ifndef SAX_LexicalHandler_INCLUDED
|
| 40 | 164 | ss | #define SAX_LexicalHandler_INCLUDED
|
| 41 | 164 | ss | |
| 42 | 164 | ss | |
| 43 | 164 | ss | #include "Poco/XML/XML.h" |
| 44 | 164 | ss | #include "Poco/XML/XMLString.h" |
| 45 | 164 | ss | |
| 46 | 164 | ss | |
| 47 | 164 | ss | namespace Poco {
|
| 48 | 164 | ss | namespace XML {
|
| 49 | 164 | ss | |
| 50 | 164 | ss | |
| 51 | 164 | ss | class XML_API LexicalHandler |
| 52 | 164 | ss | /// This is an optional extension handler for SAX2 to provide lexical information
|
| 53 | 164 | ss | /// about an XML document, such as comments and CDATA section boundaries.
|
| 54 | 164 | ss | /// XML readers are not required to recognize this handler, and it is not part of
|
| 55 | 164 | ss | /// core-only SAX2 distributions.
|
| 56 | 164 | ss | ///
|
| 57 | 164 | ss | /// The events in the lexical handler apply to the entire document, not just to the
|
| 58 | 164 | ss | /// document element, and all lexical handler events must appear between the content
|
| 59 | 164 | ss | /// handler's startDocument and endDocument events.
|
| 60 | 164 | ss | ///
|
| 61 | 164 | ss | /// To set the LexicalHandler for an XML reader, use the setProperty method with the
|
| 62 | 164 | ss | /// property name http://xml.org/sax/properties/lexical-handler and an object implementing
|
| 63 | 164 | ss | /// this interface (or null) as the value. If the reader does not report lexical events,
|
| 64 | 164 | ss | /// it will throw a SAXNotRecognizedException when you attempt to register the handler.
|
| 65 | 164 | ss | {
|
| 66 | 164 | ss | public:
|
| 67 | 164 | ss | virtual void startDTD(const XMLString& name, const XMLString& publicId, const XMLString& systemId) = 0; |
| 68 | 164 | ss | /// Report the start of DTD declarations, if any.
|
| 69 | 164 | ss | ///
|
| 70 | 164 | ss | /// This method is intended to report the beginning of the DOCTYPE declaration;
|
| 71 | 164 | ss | /// if the document has no DOCTYPE declaration, this method will not be invoked.
|
| 72 | 164 | ss | ///
|
| 73 | 164 | ss | /// All declarations reported through DTDHandler or DeclHandler events must appear
|
| 74 | 164 | ss | /// between the startDTD and endDTD events. Declarations are assumed to belong to
|
| 75 | 164 | ss | /// the internal DTD subset unless they appear between startEntity and endEntity
|
| 76 | 164 | ss | /// events. Comments and processing instructions from the DTD should also be reported
|
| 77 | 164 | ss | /// between the startDTD and endDTD events, in their original order of (logical) occurrence;
|
| 78 | 164 | ss | /// they are not required to appear in their correct locations relative to DTDHandler or
|
| 79 | 164 | ss | /// DeclHandler events, however.
|
| 80 | 164 | ss | ///
|
| 81 | 164 | ss | /// Note that the start/endDTD events will appear within the start/endDocument events from
|
| 82 | 164 | ss | /// ContentHandler and before the first startElement event.
|
| 83 | 164 | ss | |
| 84 | 164 | ss | virtual void endDTD() = 0; |
| 85 | 164 | ss | /// Report the end of DTD declarations.
|
| 86 | 164 | ss | ///
|
| 87 | 164 | ss | /// This method is intended to report the end of the DOCTYPE declaration; if the document
|
| 88 | 164 | ss | /// has no DOCTYPE declaration, this method will not be invoked.
|
| 89 | 164 | ss | |
| 90 | 164 | ss | virtual void startEntity(const XMLString& name) = 0; |
| 91 | 164 | ss | /// Report the beginning of some internal and external XML entities.
|
| 92 | 164 | ss | ///
|
| 93 | 164 | ss | /// The reporting of parameter entities (including the external DTD subset) is optional,
|
| 94 | 164 | ss | /// and SAX2 drivers that report LexicalHandler events may not implement it; you can use the
|
| 95 | 164 | ss | /// http://xml.org/sax/features/lexical-handler/parameter-entities feature to query or control
|
| 96 | 164 | ss | /// the reporting of parameter entities.
|
| 97 | 164 | ss | ///
|
| 98 | 164 | ss | /// General entities are reported with their regular names, parameter entities have '%'
|
| 99 | 164 | ss | /// prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]".
|
| 100 | 164 | ss | ///
|
| 101 | 164 | ss | /// When a SAX2 driver is providing these events, all other events must be properly nested
|
| 102 | 164 | ss | /// within start/end entity events. There is no additional requirement that events from
|
| 103 | 164 | ss | /// DeclHandler or DTDHandler be properly ordered.
|
| 104 | 164 | ss | ///
|
| 105 | 164 | ss | /// Note that skipped entities will be reported through the skippedEntity event, which is part of
|
| 106 | 164 | ss | /// the ContentHandler interface.
|
| 107 | 164 | ss | ///
|
| 108 | 164 | ss | /// Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under
|
| 109 | 164 | ss | /// any circumstances:
|
| 110 | 164 | ss | ///
|
| 111 | 164 | ss | /// * general entities within attribute values
|
| 112 | 164 | ss | /// * parameter entities within declarations
|
| 113 | 164 | ss | ///
|
| 114 | 164 | ss | /// These will be silently expanded, with no indication of where the original entity boundaries were.
|
| 115 | 164 | ss | ///
|
| 116 | 164 | ss | /// Note also that the boundaries of character references (which are not really entities anyway) are not reported.
|
| 117 | 164 | ss | ///
|
| 118 | 164 | ss | /// All start/endEntity events must be properly nested.
|
| 119 | 164 | ss | |
| 120 | 164 | ss | virtual void endEntity(const XMLString& name) = 0; |
| 121 | 164 | ss | /// Report the end of an entity.
|
| 122 | 164 | ss | |
| 123 | 164 | ss | virtual void startCDATA() = 0; |
| 124 | 164 | ss | /// Report the start of a CDATA section.
|
| 125 | 164 | ss | ///
|
| 126 | 164 | ss | /// The contents of the CDATA section will be reported through the regular characters event;
|
| 127 | 164 | ss | /// this event is intended only to report the boundary.
|
| 128 | 164 | ss | |
| 129 | 164 | ss | virtual void endCDATA() = 0; |
| 130 | 164 | ss | /// Report the end of a CDATA section.
|
| 131 | 164 | ss | |
| 132 | 164 | ss | virtual void comment(const XMLChar ch[], int start, int length) = 0; |
| 133 | 164 | ss | /// Report an XML comment anywhere in the document.
|
| 134 | 164 | ss | ///
|
| 135 | 164 | ss | /// This callback will be used for comments inside or outside the document element,
|
| 136 | 164 | ss | /// including comments in the external DTD subset (if read). Comments in the DTD must
|
| 137 | 164 | ss | /// be properly nested inside start/endDTD and start/endEntity events (if used).
|
| 138 | 164 | ss | |
| 139 | 164 | ss | protected:
|
| 140 | 164 | ss | virtual ~LexicalHandler(); |
| 141 | 164 | ss | }; |
| 142 | 164 | ss | |
| 143 | 164 | ss | |
| 144 | 164 | ss | } } // namespace Poco::XML
|
| 145 | 164 | ss | |
| 146 | 164 | ss | |
| 147 | 164 | ss | #endif // SAX_LexicalHandler_INCLUDED |
