Xalan-C++ API Documentation

The Xalan C++ XSLT Processor Version 1.11


ExtensionNSHandler.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_EXTENSIONNSHANDLER_HEADER_GUARD)
19 #define XALAN_EXTENSIONNSHANDLER_HEADER_GUARD
20 
21 
22 // Base include file. Must be first.
23 #include "XSLTDefinitions.hpp"
24 
25 
26 
27 // Base class
29 
30 
31 
33 
34 
35 
37 
38 
39 
41 
42 
43 
44 XALAN_CPP_NAMESPACE_BEGIN
45 
46 
47 
48 class Stylesheet;
50 class XalanElement;
51 class XalanNode;
52 class XalanQName;
53 
54 
55 
57 {
58 public:
59 
60  /**
61  * Construct a new extension namespace handler for a given extension NS.
62  * This doesn't do anything - just hang on to the namespace URI.
63  *
64  * @param namespaceUri extension namespace URI being implemented
65  */
67  const XalanDOMString& namespaceUri,
68  MemoryManager& theManager);
69 
70  static ExtensionNSHandler*
72  const XalanDOMString& namespaceUri,
73  MemoryManager& theManager);
74 
75  /**
76  * Construct a new extension namespace handler given all the information
77  * needed.
78  *
79  * @param namespaceUri extension namespace URI being implemented
80  * @param elemNames string containing list of elements of extension NS
81  * @param funcNames string containing list of functions of extension NS
82  * @param lang language of code implementing the extension
83  * @param srcURL value of src attribute (if any) - treated as a URL
84  * or a classname depending on the value of lang. If
85  * srcURL is not null, then scriptSrc is ignored.
86  * @param scriptSrc the actual script code (if any)
87  */
89  MemoryManager& theManager,
90  const XalanDOMString& namespaceUri,
91  const XalanDOMString& elemNames,
92  const XalanDOMString& funcNames,
93  const XalanDOMString& lang,
94  const XalanDOMString& srcURL,
95  const XalanDOMString& src);
96 
97  /**
98  * Set function local parts of extension NS. Super does the work; I
99  * just record that a component desc has been loaded.
100  *
101  * @param functions whitespace separated list of function names defined
102  * by this extension namespace
103  */
104  virtual void
105  setFunctions(const XalanDOMString& funcNames);
106 
107  /**
108  * Set the script data for this extension NS. Deferred to super for
109  * actual work - only record that a component desc has been loaded.
110  *
111  * @param lang language of the script
112  * @param srcURL value of src attribute (if any) - treated as a URL
113  * or a classname depending on the value of lang. If
114  * srcURL is not null, then scriptSrc is ignored.
115  * @param scriptSrc the actual script code (if any)
116  */
117  virtual void
119  const XalanDOMString& lang,
120  const XalanDOMString& srcURL,
121  const XalanDOMString& scriptSrc);
122 
123  /**
124  * Set element local parts of extension NS.
125  *
126  * @param elemNames whitespace separated list of element names defined
127  * by this extension namespace
128  */
129  void
130  setElements(const XalanDOMString& elemNames);
131 
132  /**
133  * Tests whether a certain element name is known within this namespace.
134  *
135  * @param element name of the element being tested
136  * @return true if known, false if not
137  */
138  bool
139  isElementAvailable (const XalanDOMString& element) const;
140 
141  /**
142  * Process a call to this extension namespace via an element. As a side
143  * effect, the results are sent to the XSLTProcessor's result tree.
144  *
145  * @param localPart element name's local part
146  * @param element extension element being processed
147  * @param stylesheetTree compiled stylesheet tree
148  * @param mode current mode
149  * @param sourceTree root of the source tree (but don't assume it's a
150  * document)
151  * @param sourceNode current context node
152  * @exception XSLProcessorException thrown if something goes wrong
153  * while running the extension handler
154  * @exception MalformedURLException if loading trouble
155  * @exception FileNotFoundException if loading trouble
156  * @exception IOException if loading trouble
157  * @exception SAXException if parsing trouble
158  */
159  void
161  StylesheetExecutionContext& executionContext,
162  const XalanDOMString& localPart,
163  const XalanElement* element,
164  Stylesheet& stylesheetTree,
165  const XalanNode* sourceTree,
166  const XalanNode* sourceNode,
167  const XalanQName& mode);
168 
169 protected:
170 
171  /**
172  * Start the component up by executing any script that needs to run
173  * at startup time. This needs to happen before any functions can be
174  * called on the component.
175  *
176  */
177  virtual void
179 
180 private:
181 
183 
184  // Extension elements of this namespace
185  ExtensionSetType m_elements;
186 
187  // True when info from the component description has been loaded. This gets
188  // set as soon as any of the info has been specified. If this is false,
189  // when processElement or processFunction is called it will use the
190  // namespace URI as a URL and try to load that location as the component
191  // description
192  bool m_componentDescLoaded;
193 
194  /**
195  * Load the component spec for this extension namespace taking the URI
196  * of this namespace as the URL to read from.
197  */
198  void
199  loadComponentDescription();
200 
201  /**
202  * extract the text nodes and CDATA content children of the given
203  * elem and return as a string. Any other types of node children
204  * are ignored
205  *
206  * @param elem element whose text and cdata children are to be
207  * concatenated together.
208  *
209  * @return string resulting from concatanating the text/cdata child
210  * nodes' values.
211  */
212  static XalanDOMString&
213  getScriptString(const XalanElement& elem, XalanDOMString& theResult);
214 };
215 
216 
217 
218 XALAN_CPP_NAMESPACE_END
219 
220 
221 
222 #endif // XALAN_EXTENSIONNSHANDLER_HEADER_GUARD
ExtensionNSHandler::setFunctions
virtual void setFunctions(const XalanDOMString &funcNames)
Set function local parts of extension NS.
ExtensionFunctionHandler.hpp
XalanDOMString.hpp
XALAN_XSLT_EXPORT
#define XALAN_XSLT_EXPORT
Definition: XSLTDefinitions.hpp:27
XalanElement
Definition: XalanElement.hpp:45
ExtensionNSHandler
Definition: ExtensionNSHandler.hpp:57
DOMStringHelper.hpp
Stylesheet
This class represents the base stylesheet or an "import" stylesheet.
Definition: Stylesheet.hpp:87
XalanSet< XalanDOMString >
ExtensionFunctionHandler
Class handling an extension namespace for XPath.
Definition: ExtensionFunctionHandler.hpp:59
ExtensionNSHandler::setElements
void setElements(const XalanDOMString &elemNames)
Set element local parts of extension NS.
XalanDOMString
Definition: XalanDOMString.hpp:46
ExtensionNSHandler::startupComponent
virtual void startupComponent()
Start the component up by executing any script that needs to run at startup time.
ExtensionNSHandler::create
static ExtensionNSHandler * create(const XalanDOMString &namespaceUri, MemoryManager &theManager)
XalanQName
Class to represent a qualified name.
Definition: XalanQName.hpp:71
ExtensionNSHandler::ExtensionNSHandler
ExtensionNSHandler(const XalanDOMString &namespaceUri, MemoryManager &theManager)
Construct a new extension namespace handler for a given extension NS.
XSLTDefinitions.hpp
ExtensionNSHandler::setScript
virtual void setScript(const XalanDOMString &lang, const XalanDOMString &srcURL, const XalanDOMString &scriptSrc)
Set the script data for this extension NS.
ExtensionNSHandler::ExtensionNSHandler
ExtensionNSHandler(MemoryManager &theManager, const XalanDOMString &namespaceUri, const XalanDOMString &elemNames, const XalanDOMString &funcNames, const XalanDOMString &lang, const XalanDOMString &srcURL, const XalanDOMString &src)
Construct a new extension namespace handler given all the information needed.
StylesheetExecutionContext
Definition: StylesheetExecutionContext.hpp:109
XalanNode
Definition: XalanNode.hpp:39
ExtensionNSHandler::processElement
void processElement(StylesheetExecutionContext &executionContext, const XalanDOMString &localPart, const XalanElement *element, Stylesheet &stylesheetTree, const XalanNode *sourceTree, const XalanNode *sourceNode, const XalanQName &mode)
Process a call to this extension namespace via an element.
ExtensionNSHandler::isElementAvailable
bool isElementAvailable(const XalanDOMString &element) const
Tests whether a certain element name is known within this namespace.
XalanSet.hpp

Interpreting class diagrams

Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.

Xalan-C++ XSLT Processor Version 1.11
Copyright © 1999-2012 The Apache Software Foundation.
All Rights Reserved.

Apache Logo