This file is indexed.

/usr/include/xmltooling/util/ParserPool.h is in libxmltooling-dev 1.6.4-1ubuntu2.

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
/**
 * Licensed to the University Corporation for Advanced Internet
 * Development, Inc. (UCAID) under one or more contributor license
 * agreements. See the NOTICE file distributed with this work for
 * additional information regarding copyright ownership.
 *
 * UCAID 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.
 */

/**
 * @file xmltooling/util/ParserPool.h
 *
 * A thread-safe pool of parsers that share characteristics.
 */

#ifndef __xmltooling_pool_h__
#define __xmltooling_pool_h__

#include <xmltooling/unicode.h>

#include <map>
#include <memory>
#include <stack>
#include <string>
#include <istream>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/sax/InputSource.hpp>
#include <xercesc/util/BinInputStream.hpp>
#include <xercesc/util/SecurityManager.hpp>
#include <xercesc/util/XMLURL.hpp>

#ifndef XMLTOOLING_NO_XMLSEC
# include <xsec/framework/XSECDefs.hpp>
#endif

#if defined (_MSC_VER)
    #pragma warning( push )
    #pragma warning( disable : 4250 4251 )
#endif

namespace xmltooling {

    class XMLTOOL_API Mutex;

    /**
     * A thread-safe pool of DOMBuilders that share characteristics.
     */
    class XMLTOOL_API ParserPool :
#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
        public xercesc::DOMLSResourceResolver
#else
        public xercesc::DOMEntityResolver
#endif
    {
        MAKE_NONCOPYABLE(ParserPool);
    public:
        /**
         * Constructs a new pool
         *
         * @param namespaceAware    indicates whether parsers should be namespace-aware or not
         * @param schemaAware       indicates whether parsers should be schema-validating or not
         */
        ParserPool(bool namespaceAware=true, bool schemaAware=false);
        ~ParserPool();

        /**
         * Creates a new document using a parser from this pool.
         *
         * @return new XML document
         *
         */
        xercesc::DOMDocument* newDocument();

        /**
         * Parses a document using a pooled parser with the proper settings
         *
         * @param domsrc An input source containing the content to be parsed
         * @return The DOM document resulting from the parse
         * @throws XMLParserException thrown if there was a problem reading, parsing, or validating the XML
         */
        xercesc::DOMDocument* parse(
#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
            xercesc::DOMLSInput& domsrc
#else
            xercesc::DOMInputSource& domsrc
#endif
            );

        /**
         * Parses a document using a pooled parser with the proper settings
         *
         * @param is An input stream containing the content to be parsed
         * @return The DOM document resulting from the parse
         * @throws XMLParserException thrown if there was a problem reading, parsing, or validating the XML
         */
        xercesc::DOMDocument* parse(std::istream& is);

        /**
         * Load OASIS catalog files to map schema namespace URIs to filenames.
         *
         * <p>This does not provide real catalog support; only the &lt;uri&gt; element
         * is supported to map from a namespace URI to a relative path or file:// URI.
         *
         * <p>Multiple files can be specified using a platform-specific path delimiter.
         *
         * @param pathname  path to one or more catalog files
         * @return true iff the catalogs were successfully processed
         */
        bool loadCatalogs(const char* pathnames);

        /**
         * Load an OASIS catalog file to map schema namespace URIs to filenames.
         *
         * <p>This does not provide real catalog support; only the &lt;uri&gt; element
         * is supported to map from a namespace URI to a relative path or file:// URI.
         *
         * @param pathname  path to a catalog file
         * @return true iff the catalog was successfully processed
         */
        bool loadCatalog(const char* pathnames);

        /**
         * Load an OASIS catalog file to map schema namespace URIs to filenames.
         *
         * This does not provide real catalog support; only the &lt;uri&gt; element
         * is supported to map from a namespace URI to a relative path or file:// URI.
         *
         * @param pathname  path to a catalog file
         * @return true iff the catalog was successfully processed
         */
        bool loadCatalog(const XMLCh* pathname);

        /**
         * Load a schema explicitly from a local file.
         *
         * Note that "successful processing" does not imply that the schema is valid,
         * only that a reference to it was successfully registered with the pool.
         *
         * @param nsURI     XML namespace to load
         * @param pathname  path to schema file
         * @return true iff the schema was successfully processed
         */
        bool loadSchema(const XMLCh* nsURI, const XMLCh* pathname);

        /**
         * Supplies all external entities (primarily schemas) to the parser
         */
#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
        xercesc::DOMLSInput* resolveResource(
            const XMLCh *const resourceType,
            const XMLCh *const namespaceUri,
            const XMLCh *const publicId,
            const XMLCh *const systemId,
            const XMLCh *const baseURI
            );
#else
        xercesc::DOMInputSource* resolveEntity(
            const XMLCh* const publicId, const XMLCh* const systemId, const XMLCh* const baseURI
            );
#endif

    private:
#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
        xercesc::DOMLSParser* createBuilder();
        xercesc::DOMLSParser* checkoutBuilder();
        void checkinBuilder(xercesc::DOMLSParser* builder);
#else
        xercesc::DOMBuilder* createBuilder();
        xercesc::DOMBuilder* checkoutBuilder();
        void checkinBuilder(xercesc::DOMBuilder* builder);
#endif

        xstring m_schemaLocations;
        std::map<xstring,xstring> m_schemaLocMap;

        bool m_namespaceAware,m_schemaAware;
#ifdef XMLTOOLING_XERCESC_COMPLIANT_DOMLS
        std::stack<xercesc::DOMLSParser*> m_pool;
#else
        std::stack<xercesc::DOMBuilder*> m_pool;
#endif
        std::auto_ptr<Mutex> m_lock;
        std::auto_ptr<xercesc::SecurityManager> m_security;
    };

    /**
     * A parser source that wraps a C++ input stream
     */
    class XMLTOOL_API StreamInputSource : public xercesc::InputSource
    {
    MAKE_NONCOPYABLE(StreamInputSource);
    public:
        /**
         * Constructs an input source around an input stream reference.
         *
         * @param is        reference to an input stream
         * @param systemId  optional system identifier to attach to the stream
         */
        StreamInputSource(std::istream& is, const char* systemId=nullptr);
        /// @cond off
        xercesc::BinInputStream* makeStream() const;
        /// @endcond

        /**
         * A Xerces input stream that wraps a C++ input stream
         */
        class XMLTOOL_API StreamBinInputStream : public xercesc::BinInputStream
        {
        public:
            /**
             * Constructs a Xerces input stream around a C++ input stream reference.
             *
             * @param is            reference to an input stream
             */
            StreamBinInputStream(std::istream& is);
            /// @cond off
#ifdef XMLTOOLING_XERCESC_64BITSAFE
            XMLFilePos curPos() const;
            const XMLCh* getContentType() const;
#else
            unsigned int curPos() const;
#endif
            xsecsize_t readBytes(XMLByte* const toFill, const xsecsize_t maxToRead);
            /// @endcond
        private:
            std::istream& m_is;
            xsecsize_t m_pos;
        };

    private:
        std::istream& m_is;
    };

    /**
     * A URL-based parser source that supports a more advanced input stream.
     */
    class XMLTOOL_API URLInputSource : public xercesc::InputSource
    {
    MAKE_NONCOPYABLE(URLInputSource);
    public:
        /**
         * Constructor.
         *
         * @param url       source of input
         * @param systemId  optional system identifier to attach to the source
         * @param cacheTag  optional pointer to string used for cache management
         * @param backingFile optional name of file to save inout stream to.
         */
        URLInputSource(const XMLCh* url, const char* systemId=nullptr, std::string* cacheTag=nullptr, std::string backingFile="");

        /**
         * Constructor taking a DOM element supporting the following content:
         *
         * <dl>
         *  <dt>uri | url</dt>
         *  <dd>identifies the remote resource</dd>
         *  <dt>verifyHost</dt>
         *  <dd>true iff name of host should be matched against TLS/SSL certificate</dd>
         *  <dt>TransportOption elements, like so:</dt>
         *  <dd>&lt;TransportOption provider="CURL" option="150"&gt;0&lt;/TransportOption&gt;</dd>
         * </dl>
         *
         * @param e         DOM to supply configuration
         * @param systemId  optional system identifier to attach to the source
         * @param cacheTag  optional pointer to string used for cache management
         * @param backingFile optional name of file to save inout stream to.
         */
        URLInputSource(const xercesc::DOMElement* e, const char* systemId=nullptr, std::string* cacheTag=nullptr, std::string backingFile="");

        /// @cond off
        virtual xercesc::BinInputStream* makeStream() const;
        /// @endcond

        /** Element name used to signal a non-successful response when fetching a remote document. */
        static const char asciiStatusCodeElementName[];

        /** Element name used to signal a non-successful response when fetching a remote document. */
        static const XMLCh utf16StatusCodeElementName[];
    private:
        std::string  m_backingFile;
#ifdef XMLTOOLING_LITE
        xercesc::XMLURL m_url;
#else
        std::string* m_cacheTag;
        xmltooling::auto_ptr_char m_url;
        const xercesc::DOMElement* m_root;

#endif
    };
};

#if defined (_MSC_VER)
    #pragma warning( pop )
#endif

#endif /* __xmltooling_pool_h__ */