00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(FORMATTERTODEPRECATEDXERCESDOM_HEADER_GUARD_1357924680) 00019 #define FORMATTERTODEPRECATEDXERCESDOM_HEADER_GUARD_1357924680 00020 00021 00022 00023 // Base include file. Must be first. 00024 #include <xalanc/XercesParserLiaison/XercesParserLiaisonDefinitions.hpp> 00025 00026 00027 00028 #include <xalanc/Include/XalanVector.hpp> 00029 00030 00031 00032 // Base class header file. 00033 #include <xalanc/PlatformSupport/FormatterListener.hpp> 00034 00035 00036 00037 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00038 00039 00040 00041 #include <xalanc/XercesParserLiaison/Deprecated/XercesBridgeTypes.hpp> 00042 00043 // Required Xerces headers 00044 00045 #if XERCES_VERSION_MAJOR >= 2 00046 #include <xercesc/dom/deprecated/DOM_Document.hpp> 00047 #include <xercesc/dom/deprecated/DOM_DocumentFragment.hpp> 00048 #include <xercesc/dom/deprecated/DOM_Element.hpp> 00049 #else 00050 #include <xercesc/dom/DOM_Document.hpp> 00051 #include <xercesc/dom/DOM_DocumentFragment.hpp> 00052 #include <xercesc/dom/DOM_Element.hpp> 00053 #endif 00054 00055 00056 XALAN_CPP_NAMESPACE_BEGIN 00057 00058 00059 00060 /** 00061 * This class takes SAX events (in addition to some extra events that SAX 00062 * doesn't handle yet) and adds the result to a document or document fragment. 00063 * 00064 * It is provided as assist developers transition away from the deprecated DOM. 00065 * 00066 * @deprecated The Xerces DOM bridge is deprecated. 00067 */ 00068 class XALAN_XERCESPARSERLIAISON_EXPORT FormatterToDeprecatedXercesDOM : public FormatterListener 00069 { 00070 public: 00071 00072 /** 00073 * Construct a FormatterToDeprecatedXercesDOM instance. it will add the DOM nodes 00074 * to the document fragment. 00075 * 00076 * @deprecated This API is deprecated and is only provided as a transition tool 00077 * @param doc document for nodes 00078 * @param docFrag document fragment for nodes 00079 * @param currentElement current element for nodes 00080 */ 00081 FormatterToDeprecatedXercesDOM( 00082 DOM_Document_Type &doc, 00083 DOM_DocumentFragmentType &docFrag, 00084 DOM_ElementType ¤tElement); 00085 00086 /** 00087 * Construct a FormatterToDeprecatedXerces DOM instance. it will add the DOM nodes 00088 * to the document. 00089 * 00090 * @deprecated This API is deprecated and is only provided as a transition tool 00091 * @param doc document for nodes 00092 * @param elem current element for nodes 00093 */ 00094 FormatterToDeprecatedXercesDOM( 00095 DOM_Document_Type &doc, 00096 DOM_ElementType ¤tElement); 00097 00098 /** 00099 * Construct a FormatterToDeprecatedXercesDOM instance. it will add the DOM nodes 00100 * to the document. 00101 * 00102 * @deprecated This API is deprecated and is only provided as a transition tool 00103 * @param doc document for nodes 00104 */ 00105 FormatterToDeprecatedXercesDOM( 00106 DOM_Document_Type &doc); 00107 00108 virtual 00109 ~FormatterToDeprecatedXercesDOM(); 00110 00111 00112 // These methods are inherited from DocumentHandler ... 00113 00114 virtual void 00115 charactersRaw( 00116 const XMLCh* const chars, 00117 const unsigned int length); 00118 00119 virtual void 00120 comment(const XMLCh* const data); 00121 00122 virtual void 00123 cdata( 00124 const XMLCh* const ch, 00125 const unsigned int length); 00126 00127 virtual void 00128 entityReference(const XMLCh* const name); 00129 00130 virtual void 00131 setDocumentLocator(const Locator* const locator); 00132 00133 virtual void 00134 startDocument(); 00135 00136 virtual void 00137 endDocument(); 00138 00139 virtual void 00140 startElement( 00141 const XMLCh* const name, 00142 AttributeListType& attrs); 00143 00144 virtual void 00145 endElement(const XMLCh* const name); 00146 00147 virtual void 00148 characters( 00149 const XMLCh* const chars, 00150 const unsigned int length); 00151 00152 virtual void 00153 ignorableWhitespace( 00154 const XMLCh* const chars, 00155 const unsigned int length); 00156 00157 virtual void 00158 processingInstruction( 00159 const XMLCh* const target, 00160 const XMLCh* const data); 00161 00162 virtual void 00163 resetDocument(); 00164 00165 DOM_Document_Type 00166 getDocument() const 00167 { 00168 return m_doc; 00169 } 00170 00171 void 00172 setDocument(DOM_Document_Type &theDocument) 00173 { 00174 m_doc = theDocument; 00175 } 00176 00177 DOM_DocumentFragmentType 00178 getDocumentFragment() const 00179 { 00180 return m_docFrag; 00181 } 00182 00183 void 00184 setDocumentFragment(DOM_DocumentFragmentType &theDocumentFragment) 00185 { 00186 m_docFrag = theDocumentFragment; 00187 } 00188 00189 DOM_ElementType 00190 getCurrentElement() const 00191 { 00192 return m_currentElem; 00193 } 00194 00195 void 00196 setCurrentElement(DOM_ElementType &theElement) 00197 { 00198 m_currentElem = theElement; 00199 } 00200 00201 private: 00202 00203 /** 00204 * Process any accumulated text and create a node for it. 00205 */ 00206 void 00207 processAccumulatedText(); 00208 00209 /** 00210 * Append a node to the current container. 00211 */ 00212 void 00213 append(DOM_NodeType &newNode); 00214 00215 /** 00216 * Create the appropriate element, complete with attributes set. 00217 * 00218 * @param theElementName The name for the new element 00219 * @param attrs The SAX AttributeList for the new attributes. 00220 * @return A pointer to the new instance. 00221 */ 00222 DOM_ElementType 00223 createElement( 00224 const XalanDOMChar* theElementName, 00225 AttributeListType& attrs); 00226 00227 void 00228 addAttributes( 00229 DOM_ElementType &theElement, 00230 AttributeListType& attrs); 00231 00232 00233 // Data members... 00234 DOM_Document_Type m_doc; 00235 00236 DOM_DocumentFragmentType m_docFrag; 00237 00238 DOM_ElementType m_currentElem; 00239 00240 typedef XalanVector<DOM_ElementType> ElementStackType; 00241 00242 ElementStackType m_elemStack; 00243 00244 XalanDOMString m_buffer; 00245 00246 XalanDOMString m_textBuffer; 00247 00248 static const XalanDOMString s_emptyString; 00249 }; 00250 00251 00252 00253 XALAN_CPP_NAMESPACE_END 00254 00255 00256 00257 #endif // FORMATTERTODEPRECATEDXERCESDOM_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.11 |
|