/usr/include/xalanc/XMLSupport/XMLParserLiaison.hpp is in libxalan-c-dev 1.11-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(XMLPARSERLIAISON_HEADER_GUARD_1357924680)
#define XMLPARSERLIAISON_HEADER_GUARD_1357924680
// Base include file. Must be first.
#include <xalanc/XMLSupport/XMLSupportDefinitions.hpp>
#include <xalanc/XalanDOM/XalanDOMString.hpp>
XALAN_DECLARE_XERCES_CLASS(DocumentHandler)
XALAN_DECLARE_XERCES_CLASS(EntityResolver)
XALAN_DECLARE_XERCES_CLASS(ErrorHandler)
XALAN_DECLARE_XERCES_CLASS(InputSource)
XALAN_DECLARE_XERCES_CLASS(XMLEntityResolver)
XALAN_CPP_NAMESPACE_BEGIN
typedef XERCES_CPP_NAMESPACE_QUALIFIER DocumentHandler DocumentHandlerType;
typedef XERCES_CPP_NAMESPACE_QUALIFIER EntityResolver EntityResolverType;
typedef XERCES_CPP_NAMESPACE_QUALIFIER ErrorHandler ErrorHandlerType;
typedef XERCES_CPP_NAMESPACE_QUALIFIER InputSource InputSourceType;
XALAN_USING_XERCES(DocumentHandler)
XALAN_USING_XERCES(EntityResolver)
XALAN_USING_XERCES(ErrorHandler)
XALAN_USING_XERCES(InputSource)
XALAN_USING_XERCES(XMLEntityResolver)
class ExecutionContext;
class FormatterListener;
class XalanAttr;
class XalanDocument;
class XalanElement;
class XALAN_XMLSUPPORT_EXPORT XMLParserLiaison
{
public:
XMLParserLiaison();
virtual
~XMLParserLiaison();
// These interfaces are new to XMLParserLiaison
/**
* Reset the instance, freeing any XalanDocument instances created
* through parseXMLStream().
*/
virtual void
reset() = 0;
/**
* Get a pointer to the current ExecutionContext instance, which
* may be null.
*
* @return A pointer to the current ExecutionContext, if any.
*/
virtual ExecutionContext*
getExecutionContext() const = 0;
/**
* Get a reference to the current MemoryManager instance.
*
* @return A pointer to the current ExecutionContext, if any.
*/
virtual MemoryManager&
getMemoryManager() = 0;
/**
* Set the current ExecutionContext instance.
*
* @parameter theContext A reference to the new ExecutionContext instance.
*/
virtual void
setExecutionContext(ExecutionContext& theContext) = 0;
/**
* Parse the text pointed at by the reader as XML, and return a DOM
* Document interface. It is recommended that you pass in some sort of
* recognizable name, such as the filename or URI, with which the reader
* can be recognized if the parse fails.
*
* The liaison owns the XalanDocument instance, and will delete it when
* asked (see DestroyDocument()), or when the liaison is reset, or goes
* out of scope.
*
* This function is not reentrant, so you cannot call it again until
* the current call exits.
*
* @param reader stream that should hold valid XML
* @param identifier used for diagnostic purposes only, some sort of
* identification for error reporting, default an empty
* string
* @return DOM document created
*/
virtual XalanDocument*
parseXMLStream(
const InputSource& inputSource,
const XalanDOMString& identifier) = 0;
/**
* Parse the text pointed at by the reader as XML. It is recommended that
* you pass in some sort of recognizable name, such as the filename or URI,
* with which the reader can be recognized if the parse fails.
*
* This function is reentrant, so you can call it again before any
* other call exits. However, it is not thread-safe.
*
* @param inputSource input source that should hold valid XML
* @param handler instance of a DocumentHandler
* @param identifier used for diagnostic purposes only, some sort of
* identification for error reporting, default an
* empty string
*/
virtual void
parseXMLStream(
const InputSource& inputSource,
DocumentHandler& handler,
const XalanDOMString& identifier) = 0;
/**
* Destroy the supplied XalanDocument instance. It must be an instance that
* was created by a previous call to parseXMLStream().
*
* @param theDocument The XalanDocument instance to destroy.
*/
virtual void
destroyDocument(XalanDocument* theDocument) = 0;
/**
* Get the amount to indent when indent-result="yes".
*
* @deprecated
*
* @return number of characters to indent
*/
virtual int
getIndent() const = 0;
/**
* Set the amount to indent when indent-result="yes".
*
* @deprecated
*
* @param i number of characters to indent
*/
virtual void
setIndent(int i) = 0;
/**
* Get whether or not validation will be performed. Validation is off by
* default.
*
* @return true to perform validation
*/
virtual bool
getUseValidation() const = 0;
/**
* If set to true, validation will be performed. Validation is off by
* default.
*
* @param b true to perform validation
*/
virtual void
setUseValidation(bool b) = 0;
/**
* Return a string suitable for telling the user what parser is being used.
*
* @return string describing parser
*/
virtual const XalanDOMString&
getParserDescription(XalanDOMString& theResult) const = 0;
/**
* This method returns the installed EntityResolver.
*
* @return The pointer to the installed EntityResolver object.
*/
virtual EntityResolver*
getEntityResolver() const = 0;
/**
* This method installs the user-specified EntityResolver on the
* parser. It allows applications to trap and redirect calls to
* external entities.
*
* A call to setEntityResolver with a non-null pointer will
* uninstall any XMLEntityResolver previously installed.
*
* @param handler A pointer to the EntityResolver to be called
* when the parser encounters references to
* external entities.
*/
virtual void
setEntityResolver(EntityResolver* resolver) = 0;
/**
* This method returns the installed XMLEntityResolver.
*
* @return The pointer to the installed XMLEntityResolver object.
*/
virtual XMLEntityResolver*
getXMLEntityResolver() const = 0;
/**
* This method installs the user-specified XMLEntityResolver on the
* parser. It allows applications to trap and redirect calls to
* external entities.
*
* A call to setXMLEntityResolver with a non-null pointer will
* uninstall any EntityResolver previously installed.
*
* @param handler A pointer to the entity resolver to be called
* when the parser encounters references to
* external entities.
*/
virtual void
setXMLEntityResolver(XMLEntityResolver* resolver) = 0;
/**
* This method returns the installed error handler.
*
* @return The pointer to the installed error handler object.
*/
virtual ErrorHandler*
getErrorHandler() const = 0;
/**
* This method installs the user-specified error handler.
*
* @param handler A pointer to the error handler to be called upon error.
*/
virtual void
setErrorHandler(ErrorHandler* handler) = 0;
// A utility class for classes to use.
class EnsureResetErrorHandler
{
public:
EnsureResetErrorHandler(
XMLParserLiaison* theLiaison = 0,
ErrorHandler* theErrorHandler = 0) :
m_liaison(theLiaison),
m_errorHandler(theErrorHandler)
{
if (theLiaison != 0)
{
theLiaison->setErrorHandler(theErrorHandler);
}
}
~EnsureResetErrorHandler()
{
if (m_liaison != 0)
{
m_liaison->setErrorHandler(m_errorHandler);
}
}
void
set(
XMLParserLiaison* theLiaison,
ErrorHandler* theErrorHandler)
{
m_liaison = theLiaison;
m_errorHandler = theErrorHandler;
if (theLiaison != 0)
{
theLiaison->setErrorHandler(theErrorHandler);
}
}
private:
XMLParserLiaison* m_liaison;
ErrorHandler* m_errorHandler;
};
protected:
// A utility class for derived classes to use.
class EnsureDestroyDocument
{
public:
EnsureDestroyDocument(
XMLParserLiaison& theLiaison,
XalanDocument* theDocument) :
m_liaison(theLiaison),
m_document(theDocument)
{
}
~EnsureDestroyDocument()
{
if (m_document != 0)
{
m_liaison.destroyDocument(m_document);
}
}
XalanDocument*
get() const
{
return m_document;
}
XalanDocument*
release()
{
XalanDocument* theDocument = m_document;
m_document = 0;
return theDocument;
}
private:
XMLParserLiaison& m_liaison;
XalanDocument* m_document;
};
private:
// Not implemented
XMLParserLiaison(const XMLParserLiaison&);
XMLParserLiaison&
operator=(const XMLParserLiaison&);
};
XALAN_CPP_NAMESPACE_END
#endif // XMLPARSERLIAISON_HEADER_GUARD_1357924680
|