Xalan-C++ API Reference  1.12.0
XSLTEngineImpl.hpp
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 #if !defined(XALAN_XSLTENGINEIMPL_HEADER_GUARD)
19 #define XALAN_XSLTENGINEIMPL_HEADER_GUARD
20 
21 
22 
23 // Base include file. Must be first.
24 #include "XSLTDefinitions.hpp"
25 
26 
27 
28 // Base class
29 #include "XSLTProcessor.hpp"
30 
31 
32 
33 
34 // Standard library headers
35 #include <cassert>
36 
37 
38 
40 
41 
42 
43 #if defined(XALAN_AUTO_PTR_REQUIRES_DEFINITION)
45 #endif
46 
47 
48 
51 
52 
53 
57 
58 
59 
61 
62 
63 
65 
66 
67 
69 
70 
71 
72 #include "OutputContextStack.hpp"
77 #include "XalanParamHolder.hpp"
78 
79 
80 
81 namespace XERCES_CPP_NAMESPACE
82 {
83  class InputSource;
84  class DocumentHandler;
85 }
86 
87 
88 
89 namespace XALAN_CPP_NAMESPACE {
90 
91 
92 
93 typedef xercesc::InputSource InputSourceType;
94 typedef xercesc::DocumentHandler DocumentHandlerType;
95 
96 using xercesc::InputSource;
97 using xercesc::DocumentHandler;
98 
99 
100 
101 // Forward declarations...
102 class DOMSupport;
103 class GenerateEvent;
104 class PrintWriter;
105 class StylesheetConstructionContext;
106 class StylesheetRoot;
107 class XalanAttr;
108 class XalanSourceTreeDocument;
109 class XalanText;
110 class XMLParserLiaison;
111 class XObject;
112 class XPathEnvSupport;
113 class XPathFactory;
114 class XPathProcessor;
115 class XSLTResultTarget;
116 
117 
118 
119 /**
120  * It's the responsibility of the XSLTEngineImpl class, collaborating with the
121  * XML parser liaison, the DOM, and the XPath engine, to transform a source
122  * tree of nodes into a result tree according to instructions and templates
123  * specified by a stylesheet tree. The process method is the primary
124  * public entry points.
125  *
126  *
127  * If you reuse the processor instance, you should call reset() between calls.
128  *
129  */
130 
132 {
133 public:
134 
136  {
137  bool
139  const XalanDOMString* theLHS,
140  const XalanDOMString* theRHS) const
141  {
142  if (theLHS == 0 && theRHS != 0)
143  {
144  return true;
145  }
146  else if (theRHS == 0)
147  {
148  return false;
149  }
150  else
151  {
152  return theLHS->compare(*theRHS) < 0 ? true : false;
153  }
154  }
155  };
156 
160 
162 
164  {
166  m_string(theString)
167  {
168  }
169 
170  bool
171  operator()(const XalanDOMString* theString) const
172  {
173  assert(theString != 0);
174 
175  return *theString == m_string;
176  }
177 
178  private:
179 
180  const XalanDOMString& m_string;
181  };
182 
188 
190 
191  // Public members
192  //---------------------------------------------------------------------
193 
194  /**
195  * Construct an XSL processor that can call back to a XML processor, so it
196  * can handle included files, and the like. You must create a new instance
197  * of the XSLTEngineImpl class each time you run a transformation.
198  *
199  * @param XMLParserLiaison liaison to an object that can help with a
200  * specific parser implementation
201  * @param xpathEnvSupport An XPathEnvSupport instance
202  * @param domSupport A DOMSupport instance for the DOM being used
203  * @param xobjectFactory object responsible for XObject objects
204  * @param xpathFactory object responsible for XPath objects
205  */
207  MemoryManager& theManager,
208  XMLParserLiaison& parserLiaison,
209  XPathEnvSupport& xpathEnvSupport,
210  DOMSupport& domSupport,
211  XObjectFactory& xobjectFactory,
212  XPathFactory& xpathFactory);
213 
214  virtual
216 
217  MemoryManager&
219  {
220  return m_xpathConstructionContext.getMemoryManager();
221  }
222 
223  MemoryManager&
225  {
226  return m_xpathConstructionContext.getMemoryManager();
227  }
228 
229  /**
230  * Perform initialization of statics -- must be called before any
231  * processing occurs. See class XSLTInit.
232  */
233  static void
234  initialize(MemoryManager& theManager);
235 
236  /**
237  * Perform termination of statics. See class XSLTInit.
238  */
239  static void
241 
242  // These methods are inherited from XSLTProcessor ...
243 
244  virtual void
246  eSource source,
247  eClassification classification,
248  const XalanDOMString& msg,
249  const Locator* locator,
250  const XalanNode* sourceNode);
251 
252  virtual void
254  eSource source,
255  eClassification classification,
256  const XalanDOMString& msg,
257  const XalanNode* sourceNode);
258 
259  virtual void
261  const XSLTInputSource& inputSource,
262  const XSLTInputSource& stylesheetSource,
263  XSLTResultTarget& outputTarget,
264  StylesheetConstructionContext& constructionContext,
265  StylesheetExecutionContext& executionContext);
266 
267  virtual void
269  const XSLTInputSource& inputSource,
270  XSLTResultTarget& outputTarget,
271  StylesheetExecutionContext& executionContext);
272 
273  virtual StylesheetRoot*
275  const XSLTInputSource& stylesheetSource,
276  StylesheetConstructionContext& constructionContext);
277 
278  virtual StylesheetRoot*
280  const XalanDOMString& xsldocURLString,
281  StylesheetConstructionContext& constructionContext);
282 
283  virtual XalanNode*
285 
286  virtual void
288 
289  virtual XMLParserLiaison&
291 
292  virtual void
294 
295  virtual void
297  const XalanDOMString& key,
298  const XalanDOMString& expression);
299 
300  virtual void
302  const XalanDOMString& key,
303  XObjectPtr value);
304 
305  virtual void
307 
308  virtual FormatterListener*
310 
311  virtual void
313 
314  // Trace-related functions...
315 
316  virtual size_type
318 
319  virtual void
321 
322  virtual void
324 
325  virtual void
327 
328  virtual void
330 
331  virtual void
333 
334  virtual bool
336 
337  virtual void
339 
340  void
342  StylesheetExecutionContext& executionContext,
343  const ElemTemplateElement& theTemplate,
344  const NodeRefListBase& nl,
345  const XPath* xpath) const;
346 
347  virtual void
349 
350  virtual void
352 
353 
354  // Inherited from PrefixResolver...
355 
356  /**
357  * Retrieve a namespace corresponding to a prefix. This assumes that
358  * the PrevixResolver hold's its own namespace context, or is a namespace
359  * context itself.
360  *
361  * @param prefix Prefix to resolve
362  * @return namespace that prefix resolves to, or null if prefix is not found
363  */
364  virtual const XalanDOMString*
365  getNamespaceForPrefix(const XalanDOMString& prefix) const;
366 
367  /**
368  * Retrieve the base URI for the resolver.
369  *
370  * @return URI string
371  */
372  virtual const XalanDOMString&
373  getURI() const;
374 
375  /**
376  * Read in the XML file, either producing a Document or calling SAX events,
377  * and register the document in a table. If the document has already been
378  * read in, it will not be reparsed.
379  *
380  * @param urlString location of the XML
381  * @param docHandler pointer to SAX event handler
382  * @param docToRegister if using a SAX event handler, the object to register in the source docs table.
383  * @return document object, which represents the parsed XML
384  * @exception SAXException
385  */
388  const XalanDOMString& urlString,
389  DocumentHandler* docHandler,
390  XalanDocument* docToRegister,
391  ErrorHandler* theErrorHandler = 0);
392 
393  /**
394  * Read in the XML file, either producing a Document or calling SAX events,
395  * and register the document in a table. If the document has already been
396  * read in, it will not be reparsed.
397  *
398  * @param inputSource location of the XML
399  * @param docHandler pointer to SAX event handler
400  * @param docToRegister if using a SAX event handler, the object to register in the source docs table.
401  * @return document object, which represents the parsed XML
402  * @exception SAXException
403  */
406  const InputSource& inputSource,
407  DocumentHandler* docHandler,
408  XalanDocument* docToRegister,
409  ErrorHandler* theErrorHandler = 0);
410 
411  /**
412  * Reset the state of the XSL processor by reading in a new XSL stylesheet
413  * from a processing instruction.
414  *
415  * @param xslURLString valid URI to an XSL stylesheet
416  * @param fragBase base of tree if URI represents document
417  * fragment
418  * @param xmlBaseIdent base identifier for stylesheet URI
419  * @param isRoot true if stylesheet is root of tree
420  * @param constructionContext context for construction of object
421  * @return pointer to stylesheet
422  */
423  Stylesheet*
425  const XalanDOMString& xslURLString,
426  XalanNode& fragBase,
427  const XalanDOMString& xmlBaseIdent,
428  bool isRoot,
429  StylesheetConstructionContext& constructionContext);
430 
431  /**
432  * Flush the pending element.
433  */
434  void
436 
437  /**
438  * Add a namespace declaration to the namespace stack
439  *
440  * @param prefix namespace prefix
441  * @param namespaceVal value of namespace
442  */
443  void
445  const XalanDOMString& prefix,
446  const XalanDOMString& namespaceVal)
447  {
448  addResultNamespaceDecl(
449  prefix,
450  namespaceVal.c_str(),
451  namespaceVal.length());
452  }
453 
454  /**
455  * Add a namespace declaration to the namespace stack
456  *
457  * @param prefix namespace prefix
458  * @param namespaceVal value of namespace
459  * @param len length of namespace
460  */
461  void
463  const XalanDOMString& prefix,
464  const XalanDOMChar* namespaceVal,
465  size_type len)
466  {
467  m_resultNamespacesStack.addDeclaration(
468  prefix,
469  namespaceVal,
470  len);
471  }
472 
473  /**
474  * Add attribute to attribute list, and if it is a namespace, add it to the
475  * namespaces stack.
476  *
477  * @param attList attribute list added to
478  * @param aname name of attribute
479  * @param value value of attribute
480  * @param fromCopy true if the attribute is being copied from the source tree
481  * @param locator The Locator for reporting errors.
482  */
483  void
485  AttributeListImpl& attList,
486  const XalanDOMString& aname,
487  const XalanDOMString& value,
488  bool fromCopy = false,
489  const Locator* locator = 0)
490  {
491  addResultAttribute(
492  attList,
493  aname,
494  value.c_str(),
495  fromCopy,
496  locator);
497  }
498 
499  /**
500  * Add attribute to attribute list, and if it is a namespace, add it to the
501  * namespaces stack.
502  *
503  * @param attList attribute list added to
504  * @param aname name of attribute
505  * @param value value of attribute
506  * @param fromCopy true if the attribute is being copied from the source tree
507  * @param locator The Locator for reporting errors.
508  */
509  void
511  AttributeListImpl& attList,
512  const XalanDOMString& aname,
513  const XalanDOMChar* value,
514  bool fromCopy = false,
515  const Locator* locator = 0)
516  {
517  addResultAttribute(
518  attList,
519  aname,
520  value,
521  length(value),
522  fromCopy,
523  locator);
524  }
525 
526  /**
527  * Add attribute to attribute list, and if it is a namespace, add it to the
528  * namespaces stack.
529  *
530  * @param attList attribute list added to
531  * @param aname name of attribute
532  * @param value value of attribute
533  * @param theLength The length of the value
534  * @param fromCopy true if the attribute is being copied from the source tree
535  * @param locator The Locator for reporting errors.
536  */
537  void
539  AttributeListImpl& attList,
540  const XalanDOMString& aname,
541  const XalanDOMChar* value,
542  size_type theLength,
543  bool fromCopy = false,
544  const Locator* locator = 0);
545 
546  /**
547  * Add attribute to pending attributes list, and if it is a namespace, add
548  * it to the namespaces stack.
549  *
550  * @param aname name of attribute
551  * @param value value of attribute
552  * @param fromCopy true if the attribute is being copied from the source tree
553  * @param locator The Locator for reporting errors.
554  */
555  void
557  const XalanDOMString& aname,
558  const XalanDOMChar* value,
559  bool fromCopy = false,
560  const Locator* locator = 0)
561  {
562  assert(m_outputContextStack.empty() == false);
563 
564  addResultAttribute(
565  getPendingAttributesImpl(),
566  aname,
567  value,
568  fromCopy,
569  locator);
570  }
571 
572  /**
573  * Add attribute to pending attributes list, and if it is a namespace, add
574  * it to the namespaces stack.
575  *
576  * @param aname name of attribute
577  * @param value value of attribute
578  * @param fromCopy true if the attribute is being copied from the source tree
579  * @param locator The Locator for reporting errors.
580  */
581  void
583  const XalanDOMString& aname,
584  const XalanDOMString& value,
585  bool fromCopy = false,
586  const Locator* locator = 0)
587  {
588  assert(m_outputContextStack.empty() == false);
589 
590  addResultAttribute(
591  getPendingAttributesImpl(),
592  aname,
593  value,
594  fromCopy,
595  locator);
596  }
597 
598  /**
599  * Report an error copying a duplicate namespace node.
600  *
601  * @param theName The name of the node.
602  */
603  void
605  const XalanDOMString& theName,
606  const Locator* locator);
607 
608  void
609  setDocumentLocator(const Locator* locator);
610 
611  void
613 
614  void
616 
617  void
619  const XalanDOMChar* name,
620  AttributeListType& atts);
621 
622  void
623  endElement(const XalanDOMChar* name);
624 
625  void
627  const XalanDOMChar* ch,
628  size_type length);
629 
630  void
632  const XalanDOMChar* ch,
633  size_type length);
634 
635  void
637  const XalanDOMChar* target,
638  const XalanDOMChar* data);
639 
640  void
642 
643  /**
644  * Receive notification of character data.
645  *
646  * @param ch pointer to characters from the XML document
647  * @param start startng offset in 'ch' array
648  * @param length number of characters to read from the array
649  */
650  void
652  const XalanDOMChar* ch,
653  size_type start,
654  size_type length);
655 
656  /**
657  * Send character data from the node to the result tree.
658  *
659  * @param node The node to send.
660  */
661  void
662  characters(const XalanNode& node);
663 
664  /**
665  * Send character data from an XObject to the result tree.
666  *
667  * @param node The xobject to send.
668  */
669  void
670  characters(const XObjectPtr& xobject);
671 
672  /**
673  * Receive notification of the beginning of an element with an empty
674  * attribute list
675  *
676  * @param name element type name
677  */
678  void
679  startElement(const XalanDOMChar* name);
680 
681  /**
682  * Receive notification of character data. If available, when the
683  * disable-output-escaping attribute is used, output raw text without
684  * escaping.
685  *
686  * @param ch pointer to characters from the XML document
687  * @param start start position in the array
688  * @param length number of characters to read from the array
689  */
690  void
692  const XalanDOMChar* ch,
693  size_type start,
694  size_type length);
695 
696  /**
697  * Send raw character data from the node to the result tree.
698  *
699  * @param node The node to send.
700  */
701  void
702  charactersRaw(const XalanNode& node);
703 
704  /**
705  * Send raw character data from an XObject to the result tree.
706  *
707  * @param node The xobject to send.
708  */
709  void
710  charactersRaw(const XObjectPtr& xobject);
711 
712  /**
713  * Called when a Comment is to be constructed.
714  *
715  * @param data pointer to comment data
716  */
717  void
718  comment(const XalanDOMChar* data);
719 
720  /**
721  * Receive notification of a entityReference.
722  *
723  * @param data pointer to characters from the XML document
724  * @exception SAXException
725  */
726  void
727  entityReference(const XalanDOMChar* data);
728 
729  /**
730  * Receive notification of cdata.
731  *
732  * @param ch pointer to characters from the XML document
733  * @param start start position in the array
734  * @param length number of characters to read from the array
735  */
736  void
738  const XalanDOMChar* ch,
739  size_type start,
740  size_type length);
741 
742  /**
743  * Clone a node to the result tree
744  *
745  * @param node node to clone
746  * @param cloneTextNodesOnly if true, only text nodes will be cloned
747  * @param locator the Locator for the event, if any.
748  */
749  void
751  const XalanNode& node,
752  bool cloneTextNodesOnly,
753  const Locator* locator);
754 
755  /**
756  * Clone a node to the result tree
757  *
758  * @param node node to clone
759  * @param nodeType the type of the node
760  * @param overrideStrip false if white space stripping should be done
761  * @param shouldCloneAttributes true if attributes should be cloned
762  * @param cloneTextNodesOnly if true, only text nodes will be cloned
763  * @param locator the Locator for the event, if any.
764  */
765  void
767  const XalanNode& node,
768  XalanNode::NodeType nodeType,
769  bool overrideStrip,
770  bool shouldCloneAttributes,
771  bool cloneTextNodesOnly,
772  const Locator* locator);
773 
774  /**
775  * Output an object to the result tree by doing the right conversions.
776  *
777  * @param value the XObject to output
778  * @param outputTextNodesOnly if true, only text nodes will be copied
779  * @param locator the Locator for the event, if any.
780  */
781  void
783  const XObject& value,
784  bool outputTextNodesOnly,
785  const Locator* locator);
786 
787  /**
788  * Given a result tree fragment, walk the tree and output it to the result
789  * stream.
790  *
791  * @param theTree result tree fragment
792  * @param outputTextNodesOnly if true, only text nodes will be copied
793  * @param locator the Locator for the event, if any.
794  */
795  void
797  const XObject& theTree,
798  bool outputTextNodesOnly,
799  const Locator* locator)
800  {
801  outputResultTreeFragment(
802  theTree.rtree(),
803  outputTextNodesOnly,
804  locator);
805  }
806 
807  /**
808  * Given a result tree fragment, walk the tree and output it to the result
809  * stream.
810  *
811  * @param theTree result tree fragment
812  * @param outputTextNodesOnly if true, only text nodes will be copied
813  * @param locator the Locator for the event, if any.
814  */
815  void
817  const XalanDocumentFragment& theTree,
818  bool outputTextNodesOnly,
819  const Locator* locator);
820 
821  /**
822  * Retrieve the root stylesheet.
823  *
824  * @return pointer to root stylesheet
825  */
826  virtual const StylesheetRoot*
828 
829  /**
830  * Set the root stylesheet.
831  *
832  * @param theStylesheet pointer to new root stylesheet
833  */
834  virtual void
835  setStylesheetRoot(const StylesheetRoot* theStylesheet);
836 
837  /**
838  * Set the execution context.
839  *
840  * @param theExecutionContext pointer to new execution context.
841  */
842  virtual void
844 
845  /**
846  * Retrieve the URI for the current XSL namespace, for example,
847  * "http://www.w3.org/1999/XSL/Transform"
848  *
849  * @return URI string
850  */
851  static const XalanDOMString&
853  {
854  return s_XSLNameSpaceURL;
855  }
856 
857  /**
858  * Special Xalan namespace for built-in extensions.
859  *
860  * @return Xalan namespace for extensions
861  */
862  static const XalanDOMString&
864  {
865  return s_XalanNamespaceURL;
866  }
867 
868  /**
869  * Whether to warn about pattern match conflicts.
870  *
871  * @return true to not warn about pattern match conflicts
872  */
873  bool
875  {
876  return m_quietConflictWarnings;
877  }
878 
879  /**
880  * Retrieve the result namespace corresponding to a prefix.
881  *
882  * @param prefix prefix for namespace
883  * @return string for namespace URI
884  */
885  const XalanDOMString*
887 
888  /**
889  * Retrieve the result prefix corresponding to a namespace.
890  *
891  * @param theNamespace namespace for prefix
892  * @return string for namespace prefix
893  */
894  const XalanDOMString*
895  getResultPrefixForNamespace(const XalanDOMString& theNamespace) const;
896 
897  /**
898  * Determine whether or not a prefix is in use on the pending element or
899  * the pending attributes.
900  *
901  * @param thePrefix prefix for namespace
902  *
903  * @return true if the prefix is in use, false if not.
904  */
905  bool
906  isPendingResultPrefix(const XalanDOMString& thePrefix) const;
907 
908  /**
909  * Evaluate an xpath string and return the result as a numberic score.
910  *
911  * @param str string to evaluate
912  * @param context context node
913  * @param executionContext current execution context
914  * @return score number, higher representing better match
915  */
916  double
918  const XalanDOMString& str,
919  XalanNode* context,
920  XPathExecutionContext& executionContext);
921 
922  /**
923  * Create and initialize an xpath and return it.
924  *
925  * @param str string for XPath
926  * @param resolver resolver for namespace resolution
927  * @return pointer to XPath created
928  */
929  const XPath*
931  const XalanDOMString& str,
932  const PrefixResolver& resolver);
933 
934  /**
935  * Return the xpath created by createXPath() or
936  * createMatchPattern().
937  *
938  * @param xpath The XPath to return.
939  */
940  void
941  returnXPath(const XPath* xpath);
942 
943  /**
944  * Copy XMLNS: attributes in if not already in scope.
945  *
946  * @param src source node
947  */
948  void
950 
951  /**
952  * Evaluate an xpath string and return the result.
953  *
954  * @param str string to evaluate
955  * @param executionContext current execution context
956  * @return pointer to XObject result
957  */
958  const XObjectPtr
960  const XalanDOMString& str,
961  XPathExecutionContext& executionContext);
962 
963  /**
964  * Evaluate an xpath string and return the result.
965  *
966  * @param str string to evaluate
967  * @param contextNode context node
968  * @param prefixResolver prefix resolver to use
969  * @param executionContext current execution context
970  * @return pointer to XObject result
971  */
972  const XObjectPtr
974  const XalanDOMString& str,
975  XalanNode* contextNode,
976  const PrefixResolver& prefixResolver,
977  XPathExecutionContext& executionContext);
978 
979  /**
980  * Evaluate an xpath string and return the result.
981  *
982  * @param str string to evaluate
983  * @param contextNode context node
984  * @param prefixResolver prefix resolver to use
985  * @param executionContext current execution context
986  * @return pointer to XObject result
987  */
988  const XObjectPtr
990  const XalanDOMString& str,
991  XalanNode* contextNode,
992  const XalanElement& prefixResolver,
993  XPathExecutionContext& executionContext);
994 
995  /**
996  * Copy an attribute to an AttributeListImpl.
997  *
998  * @param attrName The name of the attribute
999  * @param attrValue The value of the attribute
1000  * @param attrList The attribute list added to
1001  */
1002  void
1004  const XalanDOMString& attrName,
1005  const XalanDOMString& attrValue,
1006  AttributeListImpl& attrList);
1007 
1008  /**
1009  * Get the factory for making xpaths.
1010  *
1011  * @return XPath factory object
1012  */
1013  XPathFactory&
1015  {
1016  return m_xpathFactory;
1017  }
1018 
1019  /**
1020  * Get the XPath processor object.
1021  *
1022  * @return XPathProcessor interface being used
1023  */
1026  {
1027  return *m_xpathProcessor.get();
1028  }
1029 
1030  /**
1031  * Reset the state. This needs to be called after a process() call
1032  * is invoked, if the processor is to be used again.
1033  */
1034  virtual void
1036 
1037  /**
1038  * Retrieve the XPath environment support object
1039  *
1040  * @return XPath environment support object
1041  */
1044  {
1045  return m_xpathEnvSupport;
1046  }
1047 
1048  /**
1049  * Set the problem listener property. The XSL class can have a single
1050  * listener that can be informed of errors and warnings, and can normally
1051  * control if an exception is thrown or not (or the problem listeners can
1052  * throw their own RuntimeExceptions).
1053  *
1054  * @param l pointer to ProblemListener interface
1055  */
1056  void
1058  {
1059  m_problemListener = l;
1060  }
1061 
1062  /**
1063  * Get the problem listener property. The XSL class can have a single
1064  * listener that can be informed of errors and warnings, and can normally
1065  * control if an exception is thrown or not (or the problem listeners can
1066  * throw their own RuntimeExceptions).
1067  *
1068  * @return pointer to ProblemListener interface
1069  */
1072  {
1073  return m_problemListener;
1074  }
1075 
1076  /*
1077  * Push a new output context using the provided FormatterListener.
1078  *
1079  * @param A pointer to the FormatterListener instance for the new context.
1080  */
1081  void
1083  {
1084  m_outputContextStack.pushContext(theListener);
1085  }
1086 
1087  /*
1088  * Pop the current output context.
1089  */
1090  void
1092  {
1093  m_outputContextStack.popContext();
1094  }
1095 
1096  /*
1097  * See if there is a pending start document event waiting.
1098  * @return true if there is a start document event waiting.
1099  */
1100  bool
1102  {
1103  return getHasPendingStartDocumentImpl();
1104  }
1105 
1106  /*
1107  * Set the pending start document event state.
1108  * @param the new value
1109  */
1110  void
1112  {
1113  setHasPendingStartDocumentImpl(b);
1114  }
1115 
1116  /*
1117  * See if a pending start document event must be flushed.
1118  * @return true if the event must be flushed.
1119  */
1120  bool
1122  {
1123  return getMustFlushPendingStartDocumentImpl();
1124  }
1125 
1126  /*
1127  * Set the pending start document event flush state.
1128  * @param the new value
1129  */
1130  void
1132  {
1133  setMustFlushPendingStartDocumentImpl(b);
1134  }
1135 
1136  /**
1137  * Get the list of attributes yet to be processed
1138  *
1139  * @return attribute list
1140  */
1141  const AttributeListType&
1143  {
1144  return getPendingAttributesImpl();
1145  }
1146 
1147  /**
1148  * Set the list of attributes yet to be processed
1149  *
1150  * @param pendingAttributes The attribute list
1151  */
1152  void
1153  setPendingAttributes(const AttributeListType& pendingAttributes)
1154  {
1155  getPendingAttributesImpl() = pendingAttributes;
1156  }
1157 
1158  /**
1159  * Replace the contents of a pending attribute.
1160  *
1161  * @param theName name of attribute
1162  * @param theNewType type of attribute
1163  * @param theNewValue new value of attribute
1164  */
1165  void
1167  const XalanDOMChar* theName,
1168  const XalanDOMChar* theNewType,
1169  const XalanDOMChar* theNewValue)
1170  {
1171  // Remove the old attribute, then add the new one. AttributeListImpl::addAttribute()
1172  // does this for us.
1173  getPendingAttributesImpl().addAttribute(theName, theNewType, theNewValue);
1174  }
1175 
1176  bool
1178  {
1179  return !getPendingElementNameImpl().empty();
1180  }
1181 
1182  /**
1183  * Retrieve name of the pending element currently being processed.
1184  *
1185  * @return element name
1186  */
1187  const XalanDOMString&
1189  {
1190  return getPendingElementNameImpl();
1191  }
1192 
1193  /**
1194  * Changes the currently pending element name.
1195  *
1196  * @param elementName new name of element
1197  */
1198  void
1200  {
1201  setPendingElementNameImpl(elementName);
1202  }
1203 
1204  void
1205  setPendingElementName(const XalanDOMChar* elementName)
1206  {
1207  setPendingElementNameImpl(elementName);
1208  }
1209 
1210  /**
1211  * Get the locator from the top of the locator stack.
1212  *
1213  * @return A pointer to the Locator, or 0 if there is nothing on the stack.
1214  */
1215  const Locator*
1217  {
1218  return m_stylesheetLocatorStack.empty() == true ? 0 : m_stylesheetLocatorStack.back();
1219  }
1220 
1221  /**
1222  * Push a locator on to the locator stack.
1223  *
1224  * @param A pointer to the Locator to push.
1225  */
1226  void
1227  pushLocatorOnStack(const Locator* locator)
1228  {
1229  m_stylesheetLocatorStack.push_back(locator);
1230  }
1231 
1232  /**
1233  * Pop the locator from the top of the locator stack.
1234  */
1235  void
1237  {
1238  if (m_stylesheetLocatorStack.empty() == false)
1239  {
1240  m_stylesheetLocatorStack.pop_back();
1241  }
1242  }
1243 
1244 protected:
1245 
1246  /**
1247  * Get the list of attributes yet to be processed
1248  *
1249  * @return attribute list
1250  */
1251  const AttributeListImpl&
1253  {
1254  return m_outputContextStack.getPendingAttributes();
1255  }
1256 
1257  /**
1258  * Get the list of attributes yet to be processed
1259  *
1260  * @return attribute list
1261  */
1264  {
1265  return m_outputContextStack.getPendingAttributes();
1266  }
1267 
1268  /**
1269  * Set the list of attributes yet to be processed
1270  *
1271  * @param pendingAttributes The attribute list
1272  */
1273  void
1275  {
1276  getPendingAttributesImpl() = pendingAttributes;
1277  }
1278 
1279  /**
1280  * Retrieve name of the pending element currently being processed.
1281  *
1282  * @return element name
1283  */
1284  const XalanDOMString&
1286  {
1287  return m_outputContextStack.getPendingElementName();
1288  }
1289 
1290  /**
1291  * Retrieve name of the pending element currently being processed.
1292  *
1293  * @return element name
1294  */
1297  {
1298  return m_outputContextStack.getPendingElementName();
1299  }
1300 
1301  /**
1302  * Changes the currently pending element name.
1303  *
1304  * @param elementName new name of element
1305  */
1306  void
1308  {
1309  m_outputContextStack.getPendingElementName() = elementName;
1310  }
1311 
1312  /**
1313  * Changes the currently pending element name.
1314  *
1315  * @param elementName new name of element
1316  */
1317  void
1318  setPendingElementNameImpl(const XalanDOMChar* elementName)
1319  {
1320  assert(elementName != 0);
1321 
1322  m_outputContextStack.getPendingElementName() = elementName;
1323  }
1324 
1325  /*
1326  * See if there is a pending start document event waiting.
1327  * @return true if there is a start document event waiting.
1328  */
1329  bool
1331  {
1332  return m_outputContextStack.getHasPendingStartDocument();
1333  }
1334 
1335  /*
1336  * Set the pending start document event state.
1337  * @param the new value
1338  */
1339  void
1341  {
1342  m_outputContextStack.getHasPendingStartDocument() = b;
1343  }
1344 
1345  /*
1346  * See if a pending start document event must be flushed.
1347  * @return true if the event must be flushed.
1348  */
1349  bool
1351  {
1352  return m_outputContextStack.getMustFlushPendingStartDocument();
1353  }
1354 
1355  /*
1356  * Set the pending start document event flush state.
1357  * @param the new value
1358  */
1359  void
1361  {
1362  m_outputContextStack.getMustFlushPendingStartDocument() = b;
1363  }
1364 
1367  {
1368  return m_outputContextStack.getFormatterListener();
1369  }
1370 
1371  void
1373  {
1374  m_outputContextStack.getFormatterListener() = flistener;
1375  }
1376 
1377  /**
1378  * The namespace that the result tree conforms to. A null value
1379  * indicates that result-ns is not used and there is no checking.
1380  * A empty string indicates that the result tree conforms to the
1381  * default namespace.
1382  */
1384 
1385  /**
1386  * The URL that belongs to the result namespace.
1387  */
1389 
1390 
1391  /**
1392  * Copy the attributes from the XSL element to the created
1393  * output element.
1394  */
1395  void
1397  const XalanNode& node,
1398  AttributeListImpl& attList);
1399 
1400  // Factory for creating xpaths.
1402 
1403  // Factory for creating xobjects
1405 
1406  // The query/pattern-matcher object.
1408 
1409  /**
1410  * Stack of Booleans to keep track of if we should be outputting
1411  * cdata instead of escaped text.
1412  */
1414 
1415 private:
1416 
1417  /**
1418  * Issue a warning that only text nodes can be copied.
1419  *
1420  * @param sourceNode node in source where error occurred
1421  * @param locator The Locator to use, if any.
1422  */
1423  void
1424  warnCopyTextNodesOnly(
1425  const XalanNode* sourceNode,
1426  const Locator* locator);
1427 
1428  /**
1429  * Clone a text node to the result tree
1430  *
1431  * @param node node to clone
1432  * @param overrideStrip false if white space stripping should be done
1433  */
1434  void
1435  cloneToResultTree(
1436  const XalanText& node,
1437  bool overrideStrip);
1438 
1439  /**
1440  * Determine if any pending attributes is a default
1441  * namespace.
1442  */
1443  bool
1444  pendingAttributesHasDefaultNS() const;
1445 
1446  void
1447  addResultNamespace(
1448  const XalanDOMString& thePrefix,
1449  const XalanDOMString& theName,
1450  const XalanNode& theNode,
1451  AttributeListImpl& thePendingAttributes,
1452  bool fOnlyIfPrefixNotPresent);
1453 
1454  void
1455  addResultNamespace(
1456  const XalanNode& theNode,
1457  AttributeListImpl& thePendingAttributes,
1458  bool fOnlyIfPrefixNotPresent = false);
1459 
1460  /**
1461  * The top of this stack should contain the currently processed
1462  * stylesheet SAX locator object.
1463  */
1464  LocatorStack m_stylesheetLocatorStack;
1465 
1466  /**
1467  * The XSL class can have a single listener that can be informed
1468  * of errors and warnings, and can normally control if an exception
1469  * is thrown or not (or the problem listeners can throw their
1470  * own RuntimeExceptions).
1471  */
1472  ProblemListenerDefault m_defaultProblemListener;
1473 
1474  ProblemListener* m_problemListener;
1475 
1476  /**
1477  * The root of a linked set of stylesheets.
1478  */
1479  const StylesheetRoot* m_stylesheetRoot;
1480 
1481  /**
1482  * The namespace that we must match as a minimum for XSLT.
1483  */
1484  static const XalanDOMString& s_XSLNameSpaceURL; //"http://www.w3.org/1999/XSL/Transform"
1485 
1486  /**
1487  * Special Xalan namespace for built-in extensions.
1488  */
1489  static const XalanDOMString& s_XalanNamespaceURL; // "http://xml.apache.org/xalan"
1490 
1491  /**
1492  * Prefix to use when generating unique namespaces.
1493  */
1494  static const XalanDOMString& s_uniqueNamespacePrefix;
1495 
1496  /**
1497  * If this is set to true, selects will be traced
1498  */
1499  bool m_traceSelects;
1500 
1501  /**
1502  * If this is set to true, do not warn about pattern
1503  * match conflicts.
1504  */
1505  bool m_quietConflictWarnings;
1506 
1507  /*
1508  * A stream to print diagnostics to.
1509  */
1510  PrintWriter* m_diagnosticsPrintWriter;
1511 
1512  /**
1513  * List of listeners who are interested in tracing what's
1514  * being generated.
1515  */
1516  TraceListenerVectorType m_traceListeners;
1517 
1518  void
1519  problem(
1520  const XalanDOMString& msg,
1521  ProblemListener::eClassification classification,
1522  const XalanNode* sourceNode,
1523  const ElemTemplateElement* styleNode) const;
1524 
1525  void
1526  problem(
1527  const XalanDOMString& msg,
1528  ProblemListener::eClassification classification,
1529  const Locator& locator,
1530  const XalanNode* sourceNode) const;
1531 
1532  void
1533  problem(
1534  const XalanDOMString& msg,
1535  ProblemListener::eClassification classification) const;
1536 
1537  //==========================================================
1538  // SECTION: Function to do with attribute handling
1539  //==========================================================
1540 
1541  /**
1542  * This is used whenever a unique namespace is needed.
1543  */
1544  XMLUInt32 m_uniqueNSValue;
1545 
1546  ParamVectorType m_topLevelParams;
1547 
1548 public:
1549 
1550  /**
1551  * Reset the vector of top level parameters
1552  */
1553  void
1555  {
1556  m_topLevelParams.clear();
1557  }
1558 
1559 private:
1560 
1561  bool
1562  generateCDATASection() const
1563  {
1564  if (m_hasCDATASectionElements == false)
1565  {
1566  return false;
1567  }
1568  else
1569  {
1570  assert(m_cdataStack.empty() == false);
1571 
1572  return m_cdataStack.back();
1573  }
1574  }
1575 
1576  void
1577  doFlushPending()
1578  {
1579  setMustFlushPendingStartDocument(true);
1580 
1581  flushPending();
1582  }
1583 
1584  /**
1585  * Tell if a given element name should output its text
1586  * as cdata.
1587  *
1588  * @param elementName name of element
1589  * @return true if it should output as cdata
1590  */
1591  bool
1592  isCDataResultElem(const XalanDOMString& elementName);
1593 
1594  void
1595  fireCharacterGenerateEvent(
1596  const XalanNode& theNode,
1597  bool isCDATA);
1598 
1599  void
1600  fireCharacterGenerateEvent(
1601  const XObjectPtr& theXObject,
1602  bool isCDATA);
1603 
1604  void
1605  fireCharacterGenerateEvent(
1606  const XalanDOMString& theString,
1607  bool isCDATA);
1608 
1609  void
1610  fireCharacterGenerateEvent(
1611  const XalanDOMChar* ch,
1612  size_type start,
1613  size_type length,
1614  bool isCDATA);
1615 
1616  void
1617  checkDefaultNamespace(
1618  const XalanDOMString& theElementName,
1619  const XalanDOMString& theElementNamespaceURI);
1620 
1621  void
1622  error(
1623  const XalanDOMString& theMessage,
1624  const Locator* theLocator,
1625  const XalanNode* theSourceNode);
1626 
1627  void
1628  warn(
1629  const XalanDOMString& theMessage,
1630  const Locator* theLocator,
1631  const XalanNode* theSourceNode);
1632 
1633  void
1634  message(
1635  const XalanDOMString& theMessage,
1636  const Locator* theLocator,
1637  const XalanNode* theSourceNode);
1638 
1639  // Data members...
1640  XMLParserLiaison& m_parserLiaison;
1641 
1642  XPathEnvSupport& m_xpathEnvSupport;
1643 
1644  DOMSupport& m_domSupport;
1645 
1646  /**
1647  * Current execution context...
1648  */
1649  StylesheetExecutionContext* m_executionContext;
1650 
1651  /*
1652  * Stack of current output contexts...
1653  */
1654  OutputContextStack m_outputContextStack;
1655 
1656  /*
1657  * Stack of current result namespaces...
1658  */
1659  XalanNamespacesStack m_resultNamespacesStack;
1660 
1661  /*
1662  * Dummy AttributeListImpl
1663  */
1664  AttributeListImpl m_dummyAttributesList;
1665 
1666  XalanDOMString m_scratchString;
1667 
1668  XalanDOMStringPointerVectorType m_attributeNamesVisited;
1669 
1670  bool m_hasCDATASectionElements;
1671 
1672  XPathConstructionContextDefault m_xpathConstructionContext;
1673 
1674  ParamMapType m_stylesheetParams;
1675 
1676  static void
1677  installFunctions(MemoryManager& theManager);
1678 
1679  static void
1680  uninstallFunctions();
1681 
1682 
1683  static const XalanDOMString s_emptyString;
1684 
1685  static const XalanDOMString& s_stylesheetNodeName;
1686  static const XalanDOMString& s_typeString;
1687  static const XalanDOMString& s_hrefString;
1688  static const XalanDOMString& s_piTokenizerString;
1689  static const XalanDOMString& s_typeValueString1;
1690  static const XalanDOMString& s_typeValueString2;
1691  static const XalanDOMString& s_typeValueString3;
1692  static const XalanDOMString& s_typeValueString4;
1693 
1694  // Not implemented...
1695  XSLTEngineImpl(const XSLTEngineImpl&);
1696 
1697  XSLTEngineImpl&
1698  operator=(const XSLTEngineImpl&);
1699 
1700  bool
1701  operator==(const XSLTEngineImpl&) const;
1702 };
1703 
1704 
1705 
1706 }
1707 
1708 
1709 
1710 #endif // XALAN_XSLTENGINEIMPL_HEADER_GUARD
#define XALAN_XSLT_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
A SAX-based formatter interface for the XSL processor.
This is the class for events generated by the XSL processor after it generates a new node in the resu...
Local implementation of NodeRefList.
This class defines an interface for classes that resolve namespace prefixes to their URIs.
The implementation of the default error handling for Xalan.
This is the abstract class that the XSL processor uses when it has a problem of some kind,...
This acts as the stylesheet root of the stylesheet tree, and holds values that are shared by all styl...
This class represents the base stylesheet or an "import" stylesheet.
Definition: Stylesheet.hpp:87
This is the parent class of events generated for tracing the progress of the XSL processor.
Definition: TracerEvent.hpp:50
This class handles the creation of XObjects and manages their lifetime.
Class to hold XObjectPtr return types.
Definition: XObject.hpp:884
Class to hold XPath return types.
Definition: XObject.hpp:64
virtual const XalanDocumentFragment & rtree() const
Cast result object to a result tree fragment.
It's the responsibility of the XSLTEngineImpl class, collaborating with the XML parser liaison,...
const Locator * getLocatorFromStack() const
Get the locator from the top of the locator stack.
BoolVectorType m_cdataStack
Stack of Booleans to keep track of if we should be outputting cdata instead of escaped text.
virtual XalanNode * getSourceTreeFromInput(const XSLTInputSource &inputSource)
Given an input source, get the source tree.
void pushLocatorOnStack(const Locator *locator)
Push a locator on to the locator stack.
void entityReference(const XalanDOMChar *data)
Receive notification of a entityReference.
void setHasPendingStartDocument(bool b)
const XPath * createMatchPattern(const XalanDOMString &str, const PrefixResolver &resolver)
Create and initialize an xpath and return it.
void setMustFlushPendingStartDocumentImpl(bool b)
void clearTopLevelParams()
Reset the vector of top level parameters.
void addResultAttribute(const XalanDOMString &aname, const XalanDOMChar *value, bool fromCopy=false, const Locator *locator=0)
Add attribute to pending attributes list, and if it is a namespace, add it to the namespaces stack.
virtual size_type getTraceListeners() const
Determine the number of trace listeners.
void setPendingAttributesImpl(const AttributeListType &pendingAttributes)
Set the list of attributes yet to be processed.
void characters(const XObjectPtr &xobject)
Send character data from an XObject to the result tree.
void addResultNamespaceDecl(const XalanDOMString &prefix, const XalanDOMChar *namespaceVal, size_type len)
Add a namespace declaration to the namespace stack.
XPathEnvSupport & getXPathEnvSupport()
Retrieve the XPath environment support object.
virtual void reset()
Reset the state.
virtual void setTraceSelects(bool b)
void addResultAttribute(const XalanDOMString &aname, const XalanDOMString &value, bool fromCopy=false, const Locator *locator=0)
Add attribute to pending attributes list, and if it is a namespace, add it to the namespaces stack.
StylesheetExecutionContext::ParamVectorType ParamVectorType
void startElement(const XalanDOMChar *name)
Receive notification of the beginning of an element with an empty attribute list.
const XalanDOMString * getResultPrefixForNamespace(const XalanDOMString &theNamespace) const
Retrieve the result prefix corresponding to a namespace.
XalanVector< const Locator * > LocatorStack
static const XalanDOMString & getXSLNameSpaceURL()
Retrieve the URI for the current XSL namespace, for example, "http://www.w3.org/1999/XSL/Transform".
void characters(const XalanDOMChar *ch, size_type start, size_type length)
Receive notification of character data.
void setProblemListener(ProblemListener *l)
Set the problem listener property.
void comment(const XalanDOMChar *data)
Called when a Comment is to be constructed.
virtual void setStylesheetParam(const XalanDOMString &key, const XalanDOMString &expression)
Set a top-level parameter, which the stylesheet can access with a top-level xsl:param.
XPathExecutionContext::GetCachedString ECGetCachedString
virtual void fireGenerateEvent(const GenerateEvent &ge)
Fire a generate event.
void setPendingElementName(const XalanDOMString &elementName)
Changes the currently pending element name.
void charactersRaw(const XalanDOMChar *ch, size_type start, size_type length)
Receive notification of character data.
virtual StylesheetRoot * processStylesheet(const XSLTInputSource &stylesheetSource, StylesheetConstructionContext &constructionContext)
Given a stylesheet input source, compile the stylesheet into an internal representation.
XalanMap< XalanDOMString, XalanParamHolder > ParamMapType
FormatterListener * getFormatterListenerImpl() const
virtual void setDiagnosticsOutput(PrintWriter *pw)
If this is set, diagnostics will be written to the m_diagnosticsPrintWriter stream.
void traceSelect(StylesheetExecutionContext &executionContext, const ElemTemplateElement &theTemplate, const NodeRefListBase &nl, const XPath *xpath) const
Compose a diagnostic trace of the current selection.
void setPendingElementName(const XalanDOMChar *elementName)
virtual XMLParserLiaison & getXMLParserLiaison() const
Get the XML Parser Liaison that this processor uses.
virtual void clearStylesheetParams()
Clear any stylesheet params.
void setPendingAttributes(const AttributeListType &pendingAttributes)
Set the list of attributes yet to be processed.
void flushPending()
Flush the pending element.
virtual void setStylesheetRoot(const StylesheetRoot *theStylesheet)
Set the root stylesheet.
virtual void process(const XSLTInputSource &inputSource, const XSLTInputSource &stylesheetSource, XSLTResultTarget &outputTarget, StylesheetConstructionContext &constructionContext, StylesheetExecutionContext &executionContext)
Transform the source tree to the output in the given result tree target.
virtual void setExecutionContext(StylesheetExecutionContext *theExecutionContext)
Set the execution context.
void pushOutputContext(FormatterListener *theListener)
const XalanDOMString * getResultNamespaceForPrefix(const XalanDOMString &prefix) const
Retrieve the result namespace corresponding to a prefix.
void outputToResultTree(const XObject &value, bool outputTextNodesOnly, const Locator *locator)
Output an object to the result tree by doing the right conversions.
virtual FormatterListener * getFormatterListener() const
Get the current formatter listener.
virtual bool getTraceSelects() const
If this is set to true, simple traces of template calls are made.
static const XalanDOMString & getXalanXSLNameSpaceURL()
Special Xalan namespace for built-in extensions.
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const Locator *locator, const XalanNode *sourceNode)
Function that is called when a problem event occurs.
XObjectFactory & m_xobjectFactory
XalanDocument * parseXML(const XalanDOMString &urlString, DocumentHandler *docHandler, XalanDocument *docToRegister, ErrorHandler *theErrorHandler=0)
Read in the XML file, either producing a Document or calling SAX events, and register the document in...
bool getMustFlushPendingStartDocument() const
XalanVector< TraceListener * > TraceListenerVectorType
virtual void process(const XSLTInputSource &inputSource, XSLTResultTarget &outputTarget, StylesheetExecutionContext &executionContext)
Transform the source tree to the output in the given result tree target.
void copyAttributeToTarget(const XalanDOMString &attrName, const XalanDOMString &attrValue, AttributeListImpl &attrList)
Copy an attribute to an AttributeListImpl.
virtual void fireTraceEvent(const TracerEvent &te)
Fire a trace event.
virtual StylesheetRoot * processStylesheet(const XalanDOMString &xsldocURLString, StylesheetConstructionContext &constructionContext)
Given a URI to an XSL stylesheet, compile the stylesheet into an internal representation.
MemoryManager & getMemoryManager()
XalanDOMString m_resultNameSpacePrefix
The namespace that the result tree conforms to.
virtual void setQuietConflictWarnings(bool b)
If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be print...
bool getHasPendingStartDocumentImpl() const
void replacePendingAttribute(const XalanDOMChar *theName, const XalanDOMChar *theNewType, const XalanDOMChar *theNewValue)
Replace the contents of a pending attribute.
void characters(const XalanNode &node)
Send character data from the node to the result tree.
XPathProcessor & getXPathProcessor()
Get the XPath processor object.
const XObjectPtr evalXPathStr(const XalanDOMString &str, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result.
AttributeListImpl & getPendingAttributesImpl()
Get the list of attributes yet to be processed.
XSLTEngineImpl(MemoryManager &theManager, XMLParserLiaison &parserLiaison, XPathEnvSupport &xpathEnvSupport, DOMSupport &domSupport, XObjectFactory &xobjectFactory, XPathFactory &xpathFactory)
Construct an XSL processor that can call back to a XML processor, so it can handle included files,...
XalanDOMString m_resultNameSpaceURL
The URL that belongs to the result namespace.
void processingInstruction(const XalanDOMChar *target, const XalanDOMChar *data)
void outputResultTreeFragment(const XObject &theTree, bool outputTextNodesOnly, const Locator *locator)
Given a result tree fragment, walk the tree and output it to the result stream.
const AttributeListImpl & getPendingAttributesImpl() const
Get the list of attributes yet to be processed.
bool getQuietConflictWarnings() const
Whether to warn about pattern match conflicts.
XPathConstructionContext::GetCachedString CCGetCachedString
XPathFactory & m_xpathFactory
bool getHasPendingStartDocument() const
XalanVector< bool > BoolVectorType
virtual const XalanDOMString & getURI() const
Retrieve the base URI for the resolver.
virtual const XalanDOMString * getNamespaceForPrefix(const XalanDOMString &prefix) const
Retrieve a namespace corresponding to a prefix.
bool getMustFlushPendingStartDocumentImpl() const
void setPendingElementNameImpl(const XalanDOMChar *elementName)
Changes the currently pending element name.
MemoryManager & getMemoryManager() const
void cloneToResultTree(const XalanNode &node, XalanNode::NodeType nodeType, bool overrideStrip, bool shouldCloneAttributes, bool cloneTextNodesOnly, const Locator *locator)
Clone a node to the result tree.
virtual void setFormatterListener(FormatterListener *flistener)
Set the current formatter listener.
void addResultAttribute(AttributeListImpl &attList, const XalanDOMString &aname, const XalanDOMChar *value, size_type theLength, bool fromCopy=false, const Locator *locator=0)
Add attribute to attribute list, and if it is a namespace, add it to the namespaces stack.
void outputResultTreeFragment(const XalanDocumentFragment &theTree, bool outputTextNodesOnly, const Locator *locator)
Given a result tree fragment, walk the tree and output it to the result stream.
XalanDocument * parseXML(const InputSource &inputSource, DocumentHandler *docHandler, XalanDocument *docToRegister, ErrorHandler *theErrorHandler=0)
Read in the XML file, either producing a Document or calling SAX events, and register the document in...
virtual void problem(eSource source, eClassification classification, const XalanDOMString &msg, const XalanNode *sourceNode)
Function that is called when a problem event occurs.
void setPendingElementNameImpl(const XalanDOMString &elementName)
Changes the currently pending element name.
void copyAttributesToAttList(const XalanNode &node, AttributeListImpl &attList)
Copy the attributes from the XSL element to the created output element.
void endElement(const XalanDOMChar *name)
void addResultNamespaceDecl(const XalanDOMString &prefix, const XalanDOMString &namespaceVal)
Add a namespace declaration to the namespace stack.
void setMustFlushPendingStartDocument(bool b)
virtual void fireSelectEvent(const SelectionEvent &se)
Fire a selection event.
void returnXPath(const XPath *xpath)
Return the xpath created by createXPath() or createMatchPattern().
void cloneToResultTree(const XalanNode &node, bool cloneTextNodesOnly, const Locator *locator)
Clone a node to the result tree.
void ignorableWhitespace(const XalanDOMChar *ch, size_type length)
const XObjectPtr evalXPathStr(const XalanDOMString &str, XalanNode *contextNode, const PrefixResolver &prefixResolver, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result.
void addResultAttribute(AttributeListImpl &attList, const XalanDOMString &aname, const XalanDOMChar *value, bool fromCopy=false, const Locator *locator=0)
Add attribute to attribute list, and if it is a namespace, add it to the namespaces stack.
virtual void addTraceListener(TraceListener *tl)
Add a trace listener for the purposes of debugging and diagnosis.
XalanVector< const XalanDOMString * > XalanDOMStringPointerVectorType
virtual void removeTraceListener(TraceListener *tl)
Remove a trace listener.
virtual const StylesheetRoot * getStylesheetRoot() const
Retrieve the root stylesheet.
void reportDuplicateNamespaceNodeError(const XalanDOMString &theName, const Locator *locator)
Report an error copying a duplicate namespace node.
void setFormatterListenerImpl(FormatterListener *flistener)
void addResultAttribute(AttributeListImpl &attList, const XalanDOMString &aname, const XalanDOMString &value, bool fromCopy=false, const Locator *locator=0)
Add attribute to attribute list, and if it is a namespace, add it to the namespaces stack.
double evalMatchPatternStr(const XalanDOMString &str, XalanNode *context, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result as a numberic score.
void cdata(const XalanDOMChar *ch, size_type start, size_type length)
Receive notification of cdata.
XalanDOMString & getPendingElementNameImpl()
Retrieve name of the pending element currently being processed.
const XalanDOMString & getPendingElementNameImpl() const
Retrieve name of the pending element currently being processed.
Function::XObjectArgVectorType XObjectArgVectorType
const XPathProcessorPtrType m_xpathProcessor
virtual void getUniqueNamespaceValue(XalanDOMString &theValue)
Generate a random namespace prefix guaranteed to be unique.
Stylesheet * getStylesheetFromPIURL(const XalanDOMString &xslURLString, XalanNode &fragBase, const XalanDOMString &xmlBaseIdent, bool isRoot, StylesheetConstructionContext &constructionContext)
Reset the state of the XSL processor by reading in a new XSL stylesheet from a processing instruction...
void popLocatorStack()
Pop the locator from the top of the locator stack.
static void initialize(MemoryManager &theManager)
Perform initialization of statics – must be called before any processing occurs.
bool isPendingResultPrefix(const XalanDOMString &thePrefix) const
Determine whether or not a prefix is in use on the pending element or the pending attributes.
void characters(const XalanDOMChar *ch, size_type length)
void copyNamespaceAttributes(const XalanNode &src)
Copy XMLNS: attributes in if not already in scope.
void charactersRaw(const XalanNode &node)
Send raw character data from the node to the result tree.
const AttributeListType & getPendingAttributes() const
Get the list of attributes yet to be processed.
const XObjectPtr evalXPathStr(const XalanDOMString &str, XalanNode *contextNode, const XalanElement &prefixResolver, XPathExecutionContext &executionContext)
Evaluate an xpath string and return the result.
ProblemListener * getProblemListener() const
Get the problem listener property.
void startElement(const XalanDOMChar *name, AttributeListType &atts)
static void terminate()
Perform termination of statics.
void setDocumentLocator(const Locator *locator)
const XalanDOMString & getPendingElementName() const
Retrieve name of the pending element currently being processed.
XalanMemMgrAutoPtr< XPathProcessor > XPathProcessorPtrType
XPathFactory & getXPathFactory()
Get the factory for making xpaths.
void setHasPendingStartDocumentImpl(bool b)
void charactersRaw(const XObjectPtr &xobject)
Send raw character data from an XObject to the result tree.
virtual void setStylesheetParam(const XalanDOMString &key, XObjectPtr value)
Set a top-level parameter, which the stylesheet can access with a top-level xsl:param.
virtual void resolveTopLevelParams(StylesheetExecutionContext &executionContext)
Resolve the params that were pushed by the caller.
This is an interface for an XSLT Processor engine.
const XalanDOMChar * c_str() const
size_type length() const
int compare(const XalanDOMString &theString) const
bool empty() const
XalanDOMString::size_type length(const XalanDOMString &theString)
Get the length of a XalanDOMString.
size_t size_type
Definition: XalanMap.hpp:46
xercesc::InputSource InputSourceType
xercesc::AttributeList AttributeListType
xercesc::DocumentHandler DocumentHandlerType
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)
FindStringPointerFunctor(const XalanDOMString &theString)
bool operator()(const XalanDOMString *theString) const
bool operator()(const XalanDOMString *theLHS, const XalanDOMString *theRHS) const