-/*
- * Copyright 2001-2008 Internet2
+/**
+ * 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.
*
- * Licensed 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
+ * 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
+ * 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.
+ * 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.
*/
/**
#define __xmltooling_pool_h__
#include <xmltooling/unicode.h>
-#include <xmltooling/util/Threads.h>
#include <map>
#include <stack>
+#include <string>
#include <istream>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/sax/InputSource.hpp>
namespace xmltooling {
+ class XMLTOOL_API Mutex;
+
/**
* A thread-safe pool of DOMBuilders that share characteristics.
*/
* @param is reference to an input stream
* @param systemId optional system identifier to attach to the stream
*/
- StreamInputSource(std::istream& is, const char* systemId=NULL) : xercesc::InputSource(systemId), m_is(is) {}
+ StreamInputSource(std::istream& is, const char* systemId=nullptr);
/// @cond off
- virtual xercesc::BinInputStream* makeStream() const { return new StreamBinInputStream(m_is); }
+ xercesc::BinInputStream* makeStream() const;
/// @endcond
/**
*
* @param is reference to an input stream
*/
- StreamBinInputStream(std::istream& is) : m_is(is), m_pos(0) {}
+ StreamBinInputStream(std::istream& is);
/// @cond off
#ifdef XMLTOOLING_XERCESC_64BITSAFE
- XMLFilePos
+ XMLFilePos curPos() const;
+ const XMLCh* getContentType() const;
#else
- unsigned int
+ unsigned int curPos() const;
#endif
- curPos() const { return m_pos; }
xsecsize_t readBytes(XMLByte* const toFill, const xsecsize_t maxToRead);
-#ifdef XMLTOOLING_XERCESC_64BITSAFE
- const XMLCh* getContentType() const { return NULL; }
-#endif
/// @endcond
private:
std::istream& m_is;
*
* @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
*/
- URLInputSource(const XMLCh* url, const char* systemId=NULL);
+ URLInputSource(const XMLCh* url, const char* systemId=nullptr, std::string* cacheTag=nullptr);
/**
* Constructor taking a DOM element supporting the following content:
*
* @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
*/
- URLInputSource(const xercesc::DOMElement* e, const char* systemId=NULL);
+ URLInputSource(const xercesc::DOMElement* e, const char* systemId=nullptr, std::string* cacheTag=nullptr);
/// @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:
#ifdef XMLTOOLING_LITE
xercesc::XMLURL m_url;
#else
+ std::string* m_cacheTag;
xmltooling::auto_ptr_char m_url;
const xercesc::DOMElement* m_root;
#endif