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(DOMSERVICES_HEADER_GUARD_1357924680) 00019 #define DOMSERVICES_HEADER_GUARD_1357924680 00020 00021 00022 00023 // Base include file. Must be first. 00024 #include <xalanc/DOMSupport/DOMSupportDefinitions.hpp> 00025 00026 00027 00028 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00029 #include <xalanc/XalanDOM/XalanAttr.hpp> 00030 #include <xalanc/XalanDOM/XalanComment.hpp> 00031 #include <xalanc/XalanDOM/XalanDocument.hpp> 00032 #include <xalanc/XalanDOM/XalanElement.hpp> 00033 #include <xalanc/XalanDOM/XalanProcessingInstruction.hpp> 00034 #include <xalanc/XalanDOM/XalanText.hpp> 00035 00036 00037 00038 #include <xalanc/PlatformSupport/DOMStringHelper.hpp> 00039 #include <xalanc/PlatformSupport/ExecutionContext.hpp> 00040 #include <xalanc/PlatformSupport/FormatterListener.hpp> 00041 00042 00043 00044 XALAN_CPP_NAMESPACE_BEGIN 00045 00046 00047 00048 class XalanDocument; 00049 class XalanDocumentFragment; 00050 00051 00052 00053 class XALAN_DOMSUPPORT_EXPORT DOMServices 00054 { 00055 public: 00056 00057 static const XalanDOMString& s_XMLString; 00058 static const XalanDOMString& s_XMLStringWithSeparator; 00059 static const XalanDOMString& s_XMLNamespacePrefix; 00060 static const XalanDOMString& s_XMLNamespaceURI; 00061 static const XalanDOMString& s_XMLNamespace; 00062 static const XalanDOMString& s_XMLNamespaceWithSeparator; 00063 static const XalanDOMString& s_XMLNamespaceSeparatorString; 00064 static const XalanDOMString& s_XMLNamespacePrefixURI; 00065 00066 static const XalanDOMString::size_type& s_XMLStringLength; 00067 static const XalanDOMString::size_type& s_XMLStringWithSeparatorLength; 00068 static const XalanDOMString::size_type& s_XMLNamespacePrefixLength; 00069 static const XalanDOMString::size_type& s_XMLNamespaceURILength; 00070 static const XalanDOMString::size_type& s_XMLNamespaceLength; 00071 static const XalanDOMString::size_type& s_XMLNamespaceWithSeparatorLength; 00072 static const XalanDOMString::size_type& s_XMLNamespaceSeparatorStringLength; 00073 static const XalanDOMString::size_type& s_XMLNamespacePrefixURILength; 00074 00075 00076 // A dummy string to return when we need an emtpy string... 00077 static const XalanDOMString s_emptyString; 00078 00079 00080 /** 00081 * Initialize static data. Must be called before any 00082 * other functions are called. 00083 */ 00084 static void 00085 initialize(MemoryManager& theManager); 00086 00087 /** 00088 * Destroy static data. After thus function is called, 00089 * no other functions can be called. 00090 */ 00091 static void 00092 terminate(); 00093 00094 00095 /** 00096 * Retrieves data for node 00097 * 00098 * @param node DOM node whose data is to be returned 00099 * @param data a string to which the node's data will be appended 00100 */ 00101 static void 00102 getNodeData( 00103 const XalanNode& node, 00104 XalanDOMString& data); 00105 00106 /** 00107 * Retrieves data for node 00108 * 00109 * @param node DOM node whose data is to be returned 00110 * @param context The current execution context 00111 * @param data a string to which the node's data will be appended 00112 */ 00113 static void 00114 getNodeData( 00115 const XalanNode& node, 00116 ExecutionContext& context, 00117 XalanDOMString& data) 00118 { 00119 if (!context.hasPreserveOrStripSpaceConditions()) 00120 { 00121 getNodeData(node, data); 00122 } 00123 else 00124 { 00125 doGetNodeData(node, context, data); 00126 } 00127 } 00128 00129 00130 00131 /** 00132 * Retrieves data for node 00133 * 00134 * @param attribute DOM node whose data is to be returned 00135 * @param data a string to which the node's data will be appended 00136 */ 00137 static void 00138 getNodeData( 00139 const XalanAttr& attribute, 00140 XalanDOMString& data) 00141 { 00142 data.append(attribute.getNodeValue()); 00143 } 00144 00145 00146 00147 /** 00148 * Retrieves data for node 00149 * 00150 * @param comment DOM node whose data is to be returned 00151 * @param data a string to which the node's data will be appended 00152 */ 00153 static void 00154 getNodeData( 00155 const XalanComment& comment, 00156 XalanDOMString& data) 00157 { 00158 data.append(comment.getData()); 00159 } 00160 00161 /** 00162 * Retrieves data for node 00163 * 00164 * @param document DOM node whose data is to be returned 00165 * @param data a string to which the node's data will be appended 00166 */ 00167 static void 00168 getNodeData( 00169 const XalanDocument& document, 00170 XalanDOMString& data); 00171 00172 /** 00173 * Retrieves data for node 00174 * 00175 * @param document The DOM node whose data is to be returned 00176 * @param context The current execution context 00177 * @param data a string to which the node's data will be appended 00178 */ 00179 static void 00180 getNodeData( 00181 const XalanDocument& document, 00182 ExecutionContext& context, 00183 XalanDOMString& data) 00184 { 00185 if (!context.hasPreserveOrStripSpaceConditions()) 00186 { 00187 getNodeData(document, data); 00188 } 00189 else 00190 { 00191 doGetNodeData(document, context, data); 00192 } 00193 } 00194 00195 /** 00196 * Retrieves data for node 00197 * 00198 * @param documentFragment The DOM node whose data is to be returned 00199 * @param data a string to which the node's data will be appended 00200 */ 00201 static void 00202 getNodeData( 00203 const XalanDocumentFragment& documentFragment, 00204 XalanDOMString& data); 00205 00206 /** 00207 * Retrieves data for node 00208 * 00209 * @param documentFragment The DOM node whose data is to be returned 00210 * @param context The current execution context 00211 * @param data a string to which the node's data will be appended 00212 */ 00213 static void 00214 getNodeData( 00215 const XalanDocumentFragment& documentFragment, 00216 ExecutionContext& context, 00217 XalanDOMString& data) 00218 { 00219 if (!context.hasPreserveOrStripSpaceConditions()) 00220 { 00221 getNodeData(documentFragment, data); 00222 } 00223 else 00224 { 00225 doGetNodeData(documentFragment, context, data); 00226 } 00227 } 00228 00229 /** 00230 * Retrieves data for node 00231 * 00232 * @param element DOM node whose data is to be returned 00233 * @param data a string to which the node's data will be appended 00234 */ 00235 static void 00236 getNodeData( 00237 const XalanElement& element, 00238 XalanDOMString& data); 00239 00240 /** 00241 * Retrieves data for node 00242 * 00243 * @param node DOM node whose data is to be returned 00244 * @param context The current execution context 00245 * @param data a string to which the node's data will be appended 00246 */ 00247 static void 00248 getNodeData( 00249 const XalanElement& element, 00250 ExecutionContext& context, 00251 XalanDOMString& data) 00252 { 00253 if (!context.hasPreserveOrStripSpaceConditions()) 00254 { 00255 getNodeData(element, data); 00256 } 00257 else 00258 { 00259 doGetNodeData(element, context, data); 00260 } 00261 } 00262 00263 /** 00264 * Retrieves data for node 00265 * 00266 * @param pi DOM node whose data is to be returned 00267 * @param data a string to which the node's data will be appended 00268 */ 00269 static void 00270 getNodeData( 00271 const XalanProcessingInstruction& pi, 00272 XalanDOMString& data) 00273 { 00274 data.append(pi.getData()); 00275 } 00276 00277 /** 00278 * Retrieves data for node 00279 * 00280 * @param node DOM node whose data is to be returned 00281 * @param data a string to which the node's data will be appended 00282 */ 00283 static void 00284 getNodeData( 00285 const XalanText& text, 00286 XalanDOMString& data) 00287 { 00288 data.append(text.getData()); 00289 } 00290 00291 /** 00292 * Retrieves data for node 00293 * 00294 * @param text DOM node whose data is to be returned 00295 * @param context The current execution context 00296 * @param data a string to which the node's data will be appended 00297 */ 00298 static void 00299 getNodeData( 00300 const XalanText& text, 00301 ExecutionContext& context, 00302 XalanDOMString& data) 00303 { 00304 if (!context.hasPreserveOrStripSpaceConditions()) 00305 { 00306 getNodeData(text, data); 00307 } 00308 else 00309 { 00310 doGetNodeData(text, context, data); 00311 } 00312 } 00313 00314 typedef void (FormatterListener::*MemberFunctionPtr)(const XMLCh* const, const FormatterListener::size_type); 00315 00316 /** 00317 * Sends the data for a node to a FormatterListener 00318 * 00319 * @param node DOM node whose data is to be returned 00320 * @param formatterListener the FormatterListener instance to receive the data 00321 * @param function A pointer to the member function of FormatterListener to call 00322 */ 00323 static void 00324 getNodeData( 00325 const XalanNode& node, 00326 FormatterListener& formatterListener, 00327 MemberFunctionPtr function); 00328 00329 /** 00330 * Sends the data for a node to a FormatterListener 00331 * 00332 * @param node DOM node whose data is to be returned 00333 * @param context The current execution context 00334 * @param formatterListener the FormatterListener instance to receive the data 00335 * @param function A pointer to the member function of FormatterListener to call 00336 */ 00337 static void 00338 getNodeData( 00339 const XalanNode& node, 00340 ExecutionContext& context, 00341 FormatterListener& formatterListener, 00342 MemberFunctionPtr function) 00343 { 00344 if (!context.hasPreserveOrStripSpaceConditions()) 00345 { 00346 getNodeData(node, formatterListener, function); 00347 } 00348 else 00349 { 00350 doGetNodeData(node, context, formatterListener, function); 00351 } 00352 } 00353 00354 /** 00355 * Sends the data for a node to a FormatterListener 00356 * 00357 * @param attribute DOM node whose data is to be returned 00358 * @param formatterListener the FormatterListener instance to receive the data 00359 * @param fRaw Whether or not the data should be sent raw. 00360 */ 00361 static void 00362 getNodeData( 00363 const XalanAttr& attribute, 00364 FormatterListener& formatterListener, 00365 MemberFunctionPtr function) 00366 { 00367 sendData(formatterListener, function, attribute.getNodeValue()); 00368 } 00369 00370 /** 00371 * Sends the data for a node to a FormatterListener 00372 * 00373 * @param comment DOM node whose data is to be returned 00374 * @param formatterListener the FormatterListener instance to receive the data 00375 * @param fRaw Whether or not the data should be sent raw. 00376 */ 00377 static void 00378 getNodeData( 00379 const XalanComment& comment, 00380 FormatterListener& formatterListener, 00381 MemberFunctionPtr function) 00382 { 00383 sendData(formatterListener, function, comment.getData()); 00384 } 00385 00386 /** 00387 * Sends the data for a node to a FormatterListener 00388 * 00389 * @param document DOM node whose data is to be returned 00390 * @param formatterListener the FormatterListener instance to receive the data 00391 * @param fRaw Whether or not the data should be sent raw. 00392 */ 00393 static void 00394 getNodeData( 00395 const XalanDocument& document, 00396 FormatterListener& formatterListener, 00397 MemberFunctionPtr function); 00398 00399 /** 00400 * Sends the data for a node to a FormatterListener 00401 * 00402 * @param node DOM node whose data is to be returned 00403 * @param context The current execution context 00404 * @param formatterListener the FormatterListener instance to receive the data 00405 * @param function A pointer to the member function of FormatterListener to call 00406 */ 00407 static void 00408 getNodeData( 00409 const XalanDocument& document, 00410 ExecutionContext& context, 00411 FormatterListener& formatterListener, 00412 MemberFunctionPtr function) 00413 { 00414 if (!context.hasPreserveOrStripSpaceConditions()) 00415 { 00416 getNodeData(document, formatterListener, function); 00417 } 00418 else 00419 { 00420 doGetNodeData(document, context, formatterListener, function); 00421 } 00422 } 00423 00424 /** 00425 * Sends the data for a node to a FormatterListener 00426 * 00427 * @param documentFragment DOM node whose data is to be sent 00428 * @param formatterListener the FormatterListener instance to receive the data 00429 * @param fRaw Whether or not the data should be sent raw. 00430 */ 00431 static void 00432 getNodeData( 00433 const XalanDocumentFragment& documentFragment, 00434 FormatterListener& formatterListener, 00435 MemberFunctionPtr function); 00436 00437 /** 00438 * Sends the data for a node to a FormatterListener 00439 * 00440 * @param documentFragment DOM node whose data is to be sent 00441 * @param context The current execution context 00442 * @param formatterListener the FormatterListener instance to receive the data 00443 * @param fRaw Whether or not the data should be sent raw. 00444 */ 00445 static void 00446 getNodeData( 00447 const XalanDocumentFragment& documentFragment, 00448 ExecutionContext& context, 00449 FormatterListener& formatterListener, 00450 MemberFunctionPtr function) 00451 { 00452 if (!context.hasPreserveOrStripSpaceConditions()) 00453 { 00454 getNodeData(documentFragment, formatterListener, function); 00455 } 00456 else 00457 { 00458 doGetNodeData(documentFragment, context, formatterListener, function); 00459 } 00460 } 00461 00462 /** 00463 * Sends the data for a node to a FormatterListener 00464 * 00465 * @param element DOM node whose data is to be returned 00466 * @param formatterListener the FormatterListener instance to receive the data 00467 * @param fRaw Whether or not the data should be sent raw. 00468 */ 00469 static void 00470 getNodeData( 00471 const XalanElement& element, 00472 FormatterListener& formatterListener, 00473 MemberFunctionPtr function); 00474 00475 /** 00476 * Sends the data for a node to a FormatterListener 00477 * 00478 * @param node DOM node whose data is to be returned 00479 * @param context The current execution context 00480 * @param formatterListener the FormatterListener instance to receive the data 00481 * @param function A pointer to the member function of FormatterListener to call 00482 */ 00483 static void 00484 getNodeData( 00485 const XalanElement& element, 00486 ExecutionContext& context, 00487 FormatterListener& formatterListener, 00488 MemberFunctionPtr function) 00489 { 00490 if (!context.hasPreserveOrStripSpaceConditions()) 00491 { 00492 getNodeData(element, formatterListener, function); 00493 } 00494 else 00495 { 00496 doGetNodeData(element, context, formatterListener, function); 00497 } 00498 } 00499 00500 /** 00501 * Sends the data for a node to a FormatterListener 00502 * 00503 * @param pi DOM node whose data is to be returned 00504 * @param formatterListener the FormatterListener instance to receive the data 00505 * @param fRaw Whether or not the data should be sent raw. 00506 */ 00507 static void 00508 getNodeData( 00509 const XalanProcessingInstruction& pi, 00510 FormatterListener& formatterListener, 00511 MemberFunctionPtr function) 00512 { 00513 sendData(formatterListener, function, pi.getData()); 00514 } 00515 00516 /** 00517 * Sends the data for a node to a FormatterListener 00518 * 00519 * @param node DOM node whose data is to be returned 00520 * @param formatterListener the FormatterListener instance to receive the data 00521 * @param fRaw Whether or not the data should be sent raw. 00522 */ 00523 static void 00524 getNodeData( 00525 const XalanText& text, 00526 FormatterListener& formatterListener, 00527 MemberFunctionPtr function) 00528 { 00529 sendData(formatterListener, function, text.getData()); 00530 } 00531 00532 /** 00533 * Sends the data for a node to a FormatterListener 00534 * 00535 * @param node DOM node whose data is to be returned 00536 * @param context The current execution context 00537 * @param formatterListener the FormatterListener instance to receive the data 00538 * @param fRaw Whether or not the data should be sent raw. 00539 */ 00540 static void 00541 getNodeData( 00542 const XalanText& text, 00543 ExecutionContext& context, 00544 FormatterListener& formatterListener, 00545 MemberFunctionPtr function) 00546 { 00547 if (!context.hasPreserveOrStripSpaceConditions()) 00548 { 00549 getNodeData(text, formatterListener, function); 00550 } 00551 else 00552 { 00553 doGetNodeData(text, context, formatterListener, function); 00554 } 00555 } 00556 00557 /** 00558 * Retrieve the name of the node, taking into 00559 * account the differences between the DOM and 00560 * XSLT data models. 00561 * 00562 * @param node DOM node whose name is returned 00563 * @return name of the node 00564 */ 00565 static const XalanDOMString& 00566 getNameOfNode(const XalanNode& n); 00567 00568 /** 00569 * Retrieve the name of the node, taking into 00570 * account the differences between the DOM and 00571 * XSLT data models. 00572 * 00573 * @param attr DOM attribute node whose name is returned 00574 * @return name of the node 00575 */ 00576 static const XalanDOMString& 00577 getNameOfNode(const XalanAttr& attr) 00578 { 00579 const XalanDOMString& theName = attr.getNodeName(); 00580 00581 if (startsWith(theName, s_XMLNamespaceWithSeparator) == true) 00582 { 00583 // Special case for namespace nodes... 00584 return attr.getLocalName(); 00585 } 00586 else if (equals(theName, s_XMLNamespace) == true) 00587 { 00588 return s_emptyString; 00589 } 00590 else 00591 { 00592 return theName; 00593 } 00594 } 00595 00596 /** 00597 * Retrieve the name of the node, taking into 00598 * account the differences between the DOM and 00599 * XSLT data models. 00600 * 00601 * @param attr DOM element node whose name is returned 00602 * @return name of the node 00603 */ 00604 static const XalanDOMString& 00605 getNameOfNode(const XalanElement& element) 00606 { 00607 return element.getNodeName(); 00608 } 00609 00610 /** 00611 * Retrieve local name of node, taking into 00612 * account the differences between the DOM and 00613 * XSLT data models. 00614 * 00615 * @param node DOM node whose name is returned 00616 * @return name of node without namespace 00617 */ 00618 static const XalanDOMString& 00619 getLocalNameOfNode(const XalanNode& n) 00620 { 00621 const XalanDOMString& theLocalName = n.getLocalName(); 00622 00623 if (theLocalName.empty() == false) 00624 { 00625 return theLocalName; 00626 } 00627 else 00628 { 00629 return n.getNodeName(); 00630 } 00631 } 00632 00633 /** 00634 * Retrieve the namespace of the node, taking into 00635 * account the differences between the DOM and 00636 * XSLT data models. 00637 * 00638 * @param node DOM node whose namespace is returned 00639 * @return namespace of the node 00640 */ 00641 static const XalanDOMString& 00642 getNamespaceOfNode(const XalanNode& n); 00643 00644 /** 00645 * Determine whether or not an attribute node 00646 * is declaring a namespace. 00647 * 00648 * @param node DOM node to check 00649 * @return true if the attribute is declaring a namespace, false if not. 00650 */ 00651 static bool 00652 isNamespaceDeclaration(const XalanAttr& n) 00653 { 00654 const XalanDOMString& theName = n.getNodeName(); 00655 00656 return startsWith(theName, DOMServices::s_XMLNamespaceWithSeparator) == true || 00657 equals(theName, DOMServices::s_XMLNamespace) == true; 00658 } 00659 00660 /** 00661 * Retrieve the parent of a node. This function has to be implemented, 00662 * because the DOM WG decided that attributes don't have parents. 00663 * 00664 * @param node child node 00665 * @return parent node 00666 */ 00667 static XalanNode* 00668 getParentOfNode(const XalanNode& node) 00669 { 00670 if(node.getNodeType() == XalanNode::ATTRIBUTE_NODE) 00671 { 00672 return static_cast<const XalanAttr&>(node).getOwnerElement(); 00673 } 00674 else 00675 { 00676 return node.getParentNode(); 00677 } 00678 } 00679 00680 /** 00681 * Retrieve the URI corresponding to a namespace prefix 00682 * 00683 * @param prefix prefix for a namespace 00684 * @param namespaceContext DOM element representing the context for namespace 00685 * @return URI corresponding to namespace 00686 */ 00687 static const XalanDOMString* 00688 getNamespaceForPrefix( 00689 const XalanDOMString& prefix, 00690 const XalanElement& namespaceContext); 00691 00692 /** 00693 * Retrieve the URI corresponding to a namespace prefix, using the supplied 00694 * name, and PrefixResolver. The routine also returns the prefix. 00695 * 00696 * @param theName The name that contains the prefix 00697 * @param thePrefixResolver The PrefixResolver to use 00698 * @param isAttribute If true, special rules for attributes are used 00699 * @param thePrefix The prefix 00700 * @return URI corresponding to namespace 00701 */ 00702 static const XalanDOMString* 00703 getNamespaceForPrefix( 00704 const XalanDOMChar* theName, 00705 const PrefixResolver& thePrefixResolver, 00706 bool isAttribute, 00707 XalanDOMString& thePrefix); 00708 00709 /** 00710 * Determine if a node is after another node, in document order. 00711 * 00712 * @param node1 The first node 00713 * @param node2 The second node 00714 * @return true if node1 one is after node2, or false if it is not. 00715 */ 00716 static bool 00717 isNodeAfter( 00718 const XalanNode& node1, 00719 const XalanNode& node2); 00720 00721 /** 00722 * Determine if a node is after another node in the sibling list. 00723 * 00724 * @param parent The parent of the nodes. 00725 * @param node1 The first node 00726 * @param node2 The second node 00727 * @return true if node1 one is after node2, or false if it is not. 00728 */ 00729 static bool 00730 isNodeAfterSibling( 00731 const XalanNode& parent, 00732 const XalanNode& child1, 00733 const XalanNode& child2); 00734 00735 private: 00736 00737 friend void 00738 getChildData( 00739 const XalanNode* child, 00740 XalanDOMString& data); 00741 00742 friend void 00743 getChildData( 00744 const XalanNode* child, 00745 ExecutionContext& executionContext, 00746 XalanDOMString& data); 00747 00748 friend void 00749 getChildData( 00750 const XalanNode* child, 00751 FormatterListener& formatterListener, 00752 DOMServices::MemberFunctionPtr function); 00753 00754 /** 00755 * Retrieves data for node 00756 * 00757 * @param node DOM node whose data is to be returned 00758 * @param context The current execution context 00759 * @param data a string to which the node's data will be appended 00760 */ 00761 static void 00762 doGetNodeData( 00763 const XalanNode& node, 00764 ExecutionContext& executionContext, 00765 XalanDOMString& data); 00766 00767 /** 00768 * Retrieves data for node 00769 * 00770 * @param document DOM node whose data is to be returned 00771 * @param context The current execution context 00772 * @param data a string to which the node's data will be appended 00773 */ 00774 static void 00775 doGetNodeData( 00776 const XalanDocument& document, 00777 ExecutionContext& context, 00778 XalanDOMString& data); 00779 00780 /** 00781 * Retrieves data for node 00782 * 00783 * @param documentFragment DOM node whose data is to be returned 00784 * @param context The current execution context 00785 * @param data a string to which the node's data will be appended 00786 */ 00787 static void 00788 doGetNodeData( 00789 const XalanDocumentFragment& documentFragment, 00790 ExecutionContext& context, 00791 XalanDOMString& data); 00792 00793 /** 00794 * Retrieves data for node 00795 * 00796 * @param element DOM node whose data is to be returned 00797 * @param context The current execution context 00798 * @param data a string to which the node's data will be appended 00799 */ 00800 static void 00801 doGetNodeData( 00802 const XalanElement& element, 00803 ExecutionContext& context, 00804 XalanDOMString& data); 00805 00806 /** 00807 * Retrieves data for node 00808 * 00809 * @param node DOM node whose data is to be returned 00810 * @param context The current execution context 00811 * @param data a string to which the node's data will be appended 00812 */ 00813 static void 00814 doGetNodeData( 00815 const XalanText& text, 00816 ExecutionContext& context, 00817 XalanDOMString& data) 00818 { 00819 assert(context.hasPreserveOrStripSpaceConditions() == true); 00820 00821 if (context.shouldStripSourceNode(text) == false) 00822 { 00823 data.append(text.getData()); 00824 } 00825 } 00826 00827 /** 00828 * Sends the data for a node to a FormatterListener 00829 * 00830 * @param node DOM node whose data is to be returned 00831 * @param context The current execution context 00832 * @param formatterListener the FormatterListener instance to receive the data 00833 * @param function A pointer to the member function of FormatterListener to call 00834 */ 00835 static void 00836 doGetNodeData( 00837 const XalanNode& node, 00838 ExecutionContext& context, 00839 FormatterListener& formatterListener, 00840 MemberFunctionPtr function); 00841 00842 /** 00843 * Sends the data for a node to a FormatterListener 00844 * 00845 * @param node DOM node whose data is to be returned 00846 * @param context The current execution context 00847 * @param formatterListener the FormatterListener instance to receive the data 00848 * @param function A pointer to the member function of FormatterListener to call 00849 */ 00850 static void 00851 doGetNodeData( 00852 const XalanDocument& document, 00853 ExecutionContext& context, 00854 FormatterListener& formatterListener, 00855 MemberFunctionPtr function); 00856 00857 /** 00858 * Sends the data for a node to a FormatterListener 00859 * 00860 * @param documentFragment DOM node whose data is to be sent 00861 * @param context The current execution context 00862 * @param formatterListener the FormatterListener instance to receive the data 00863 * @param fRaw Whether or not the data should be sent raw. 00864 */ 00865 static void 00866 doGetNodeData( 00867 const XalanDocumentFragment& documentFragment, 00868 ExecutionContext& context, 00869 FormatterListener& formatterListener, 00870 MemberFunctionPtr function); 00871 00872 /** 00873 * Sends the data for a node to a FormatterListener 00874 * 00875 * @param node DOM node whose data is to be returned 00876 * @param context The current execution context 00877 * @param formatterListener the FormatterListener instance to receive the data 00878 * @param function A pointer to the member function of FormatterListener to call 00879 */ 00880 static void 00881 doGetNodeData( 00882 const XalanElement& element, 00883 ExecutionContext& context, 00884 FormatterListener& formatterListener, 00885 MemberFunctionPtr function); 00886 00887 /** 00888 * Sends the data for a node to a FormatterListener 00889 * 00890 * @param node DOM node whose data is to be returned 00891 * @param context The current execution context 00892 * @param formatterListener the FormatterListener instance to receive the data 00893 * @param fRaw Whether or not the data should be sent raw. 00894 */ 00895 static void 00896 doGetNodeData( 00897 const XalanText& text, 00898 ExecutionContext& context, 00899 FormatterListener& formatterListener, 00900 MemberFunctionPtr function) 00901 { 00902 assert(context.hasPreserveOrStripSpaceConditions() == true); 00903 00904 if (context.shouldStripSourceNode(text) == false) 00905 { 00906 sendData(formatterListener, function, text.getData()); 00907 } 00908 } 00909 00910 /** 00911 * Utility function to send data to a FormatterListener 00912 * 00913 * @param formatterListener The FormatterListener instance. 00914 * @param fRaw Whether or not the data should be sent raw. 00915 * @param data The data to send. 00916 */ 00917 static void 00918 sendData( 00919 FormatterListener& formatterListener, 00920 MemberFunctionPtr function, 00921 const XalanDOMString& data) 00922 { 00923 const XalanDOMString::size_type theLength = 00924 data.length(); 00925 00926 if (theLength != 0) 00927 { 00928 assert(theLength == FormatterListener::size_type(theLength)); 00929 00930 (formatterListener.*function)( 00931 data.c_str(), 00932 FormatterListener::size_type(theLength)); 00933 } 00934 } 00935 }; 00936 00937 00938 00939 XALAN_CPP_NAMESPACE_END 00940 00941 00942 00943 #endif // DOMSERVICES_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 |
|