00001 /* 00002 * Copyright 1999-2004 The Apache Software Foundation. 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #if !defined(FORMATTERLISTENER_HEADER_GUARD_1357924680) 00017 #define FORMATTERLISTENER_HEADER_GUARD_1357924680 00018 00026 00027 00028 00029 // Base include file. Must be first. 00030 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp> 00031 00032 00033 00034 #include <xercesc/sax/DocumentHandler.hpp> 00035 00036 00037 00038 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00039 00040 00041 00042 XALAN_CPP_NAMESPACE_BEGIN 00043 00044 00045 00046 class PrefixResolver; 00047 class Writer; 00048 00049 00050 00051 typedef XERCES_CPP_NAMESPACE_QUALIFIER Locator LocatorType; 00052 typedef XERCES_CPP_NAMESPACE_QUALIFIER AttributeList AttributeListType; 00053 00054 XALAN_USING_XERCES(Locator) 00055 XALAN_USING_XERCES(AttributeList) 00056 00057 00062 class XALAN_PLATFORMSUPPORT_EXPORT FormatterListener : public XERCES_CPP_NAMESPACE_QUALIFIER DocumentHandler 00063 { 00064 public: 00065 00066 typedef XERCES_CPP_NAMESPACE_QUALIFIER DocumentHandler ParentType; 00067 00068 // A handy typedef... Must match DocumentHandler's type for characters(), etc... 00069 typedef unsigned int size_type; 00070 00071 enum eFormat 00072 { 00073 OUTPUT_METHOD_NONE = 0, 00074 OUTPUT_METHOD_XML = 1, 00075 OUTPUT_METHOD_HTML = 2, 00076 OUTPUT_METHOD_TEXT = 3, 00077 OUTPUT_METHOD_DOM = 4, 00078 OUTPUT_METHOD_OTHER = 5 00079 }; 00080 00081 enum eXMLVersion 00082 { 00083 XML_VERSION_1_0 = 0, 00084 XML_VERSION_1_1 = 1 00085 }; 00086 00087 FormatterListener(eFormat theFormat); 00088 00089 virtual 00090 ~FormatterListener(); 00091 00097 eFormat 00098 getOutputFormat() const 00099 { 00100 return m_outputFormat; 00101 } 00102 00109 eXMLVersion 00110 getXMLVersion() const 00111 { 00112 return m_XMLVersion; 00113 } 00114 00120 bool 00121 isXML1_1Version() const 00122 { 00123 return ( XML_VERSION_1_1 == m_XMLVersion ); 00124 } 00125 00131 const PrefixResolver* 00132 getPrefixResolver() const 00133 { 00134 return m_prefixResolver; 00135 } 00136 00142 void 00143 setPrefixResolver(const PrefixResolver* thePrefixResolver) 00144 { 00145 m_prefixResolver = thePrefixResolver; 00146 } 00147 00157 virtual void 00158 charactersRaw( 00159 const XMLCh* const chars, 00160 const size_type length) = 0; 00161 00168 virtual void 00169 comment(const XMLCh* const data) = 0; 00170 00192 virtual void 00193 cdata( 00194 const XMLCh* const ch, 00195 const size_type length) = 0; 00196 00203 virtual void 00204 entityReference(const XMLCh* const name) = 0; 00205 00206 00207 // These methods are inherited from DocumentHandler ... 00208 00209 virtual void 00210 characters( 00211 const XMLCh* const chars, 00212 const size_type length) = 0; 00213 00214 virtual void 00215 endDocument() = 0; 00216 00217 virtual void 00218 endElement(const XMLCh* const name) = 0; 00219 00220 virtual void 00221 ignorableWhitespace( 00222 const XMLCh* const chars, 00223 const size_type length) = 0; 00224 00225 virtual void 00226 processingInstruction( 00227 const XMLCh* const target, 00228 const XMLCh* const data) = 0; 00229 00230 virtual void 00231 resetDocument() = 0; 00232 00233 virtual void 00234 setDocumentLocator(const Locator* const locator) = 0; 00235 00236 virtual void 00237 startDocument() = 0; 00238 00239 virtual void 00240 startElement( 00241 const XMLCh* const name, 00242 AttributeList& attrs) = 0; 00243 00244 virtual Writer* 00245 getWriter() const; 00246 00247 virtual const XalanDOMString& 00248 getDoctypeSystem() const; 00249 00250 virtual const XalanDOMString& 00251 getDoctypePublic() const; 00252 00253 virtual const XalanDOMString& 00254 getEncoding() const; 00255 00256 virtual const XalanDOMString& 00257 getMediaType() const; 00258 00259 virtual int 00260 getIndent() const; 00261 00262 00263 // Used when creating PI to work around limitations of 00264 // our interfaces... 00265 static const XalanDOMChar s_piTarget[]; 00266 00267 static const XalanDOMChar s_piData[]; 00268 00269 #if defined(XALAN_INLINE_INITIALIZATION) 00270 static const XalanDOMString::size_type s_piTargetLength = 5; 00271 static const XalanDOMString::size_type s_piDataLength = 3; 00272 #else 00273 static const XalanDOMString::size_type s_piTargetLength; 00274 static const XalanDOMString::size_type s_piDataLength; 00275 #endif 00276 00277 00278 protected: 00279 00280 // Data membmers... 00281 const PrefixResolver* m_prefixResolver; 00282 00283 static const XalanDOMString s_emptyString; 00284 00290 void 00291 setXMLVersion(eXMLVersion theVersion) 00292 { 00293 m_XMLVersion = theVersion; 00294 } 00295 00296 private: 00297 00298 // Not implemented... 00299 FormatterListener(const FormatterListener&); 00300 00301 FormatterListener& 00302 operator=(const FormatterListener&); 00303 00304 bool 00305 operator==(const FormatterListener&) const; 00306 00307 // Data membmers... 00308 const eFormat m_outputFormat; 00309 00310 eXMLVersion m_XMLVersion; 00311 }; 00312 00313 00314 00315 XALAN_CPP_NAMESPACE_END 00316 00317 00318 00319 #endif // FORMATTERLISTENER_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.10 |
|