|
||||
File indexing completed on 2025-01-30 10:27:04
0001 /* 0002 * Licensed to the Apache Software Foundation (ASF) under one or more 0003 * contributor license agreements. See the NOTICE file distributed with 0004 * this work for additional information regarding copyright ownership. 0005 * The ASF licenses this file to You under the Apache License, Version 2.0 0006 * (the "License"); you may not use this file except in compliance with 0007 * the License. You may obtain a copy of the License at 0008 * 0009 * http://www.apache.org/licenses/LICENSE-2.0 0010 * 0011 * Unless required by applicable law or agreed to in writing, software 0012 * distributed under the License is distributed on an "AS IS" BASIS, 0013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 0014 * See the License for the specific language governing permissions and 0015 * limitations under the License. 0016 */ 0017 0018 /* 0019 * $Id$ 0020 */ 0021 0022 #if !defined(XERCESC_INCLUDE_GUARD_URLINPUTSOURCE_HPP) 0023 #define XERCESC_INCLUDE_GUARD_URLINPUTSOURCE_HPP 0024 0025 #include <xercesc/util/XMLURL.hpp> 0026 #include <xercesc/sax/InputSource.hpp> 0027 0028 XERCES_CPP_NAMESPACE_BEGIN 0029 0030 class BinInputStream; 0031 0032 /** 0033 * This class is a derivative of the standard InputSource class. It provides 0034 * for the parser access to data which is referenced via a URL, as apposed to 0035 * a local file name. The URL can be provided via an XMLURL class, as a fully 0036 * qualified system id, or a base system id and a system id which may be 0037 * fully qualified or may be relative to the base. 0038 * 0039 * As with all InputSource derivatives. The primary objective of an input 0040 * source is to create an input stream via which the parser can spool in 0041 * data from the referenced source. 0042 * 0043 * Note that the parse system does not necessarily support URL based XML 0044 * entities out of the box. Support for socket based access is optional and 0045 * controlled by the per-platform support. 0046 */ 0047 class XMLPARSER_EXPORT URLInputSource : public InputSource 0048 { 0049 public : 0050 // ----------------------------------------------------------------------- 0051 // Constructors and Destructor 0052 // ----------------------------------------------------------------------- 0053 0054 /** @name Constructors */ 0055 //@{ 0056 0057 /** 0058 * This constructor accepts an already built URL. It is assumed that 0059 * it is correct and it will be used as is. In this case, no public id 0060 * accepted, but it can still be set via the parent class' setPublicId() 0061 * method. 0062 * 0063 * @param urlId The URL which holds the system id of the entity 0064 * to parse. 0065 * @param manager Pointer to the memory manager to be used to 0066 * allocate objects. 0067 */ 0068 URLInputSource 0069 ( 0070 const XMLURL& urlId 0071 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 0072 ); 0073 0074 0075 /** 0076 * This constructor takes a base system id URL and a possibly relative 0077 * system id. The relative part is parsed and, if it is indeed relative, 0078 * it will be made relative to the passed base id. Otherwise, it will be 0079 * taken as is. 0080 * 0081 * @param baseId The base system id URL which provides the base 0082 * for any relative id part. 0083 * 0084 * @param systemId The possibly relative system id URL. If its relative 0085 * its based on baseId, else its taken as is. 0086 * @param manager Pointer to the memory manager to be used to 0087 * allocate objects. 0088 */ 0089 URLInputSource 0090 ( 0091 const XMLCh* const baseId 0092 , const XMLCh* const systemId 0093 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 0094 ); 0095 0096 /** 0097 * This constructor is identical to the previous one, except that it also 0098 * allows you to set a public id if you want to. 0099 * 0100 * @param baseId The base system id URL which provides the base 0101 * for any relative id part. 0102 * 0103 * @param systemId The possibly relative system id URL. If its relative 0104 * its based on baseId, else its taken as is. 0105 * 0106 * @param publicId The optional public id to set. This is just passed 0107 * on to the parent class for storage. 0108 * 0109 * @param manager Pointer to the memory manager to be used to 0110 * allocate objects. 0111 */ 0112 URLInputSource 0113 ( 0114 const XMLCh* const baseId 0115 , const XMLCh* const systemId 0116 , const XMLCh* const publicId 0117 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 0118 ); 0119 0120 0121 /** 0122 * This constructor is identical to the second constructor above, except that 0123 * it accepts the relative system id part as a local code page string and 0124 * just transcodes it internally, as a convenience. 0125 * 0126 * @param baseId The base system id URL which provides the base 0127 * for any relative id part. 0128 * 0129 * @param systemId The possibly relative system id URL. If its relative 0130 * its based on baseId, else its taken as is. 0131 * 0132 * @param manager Pointer to the memory manager to be used to 0133 * allocate objects. 0134 */ 0135 URLInputSource 0136 ( 0137 const XMLCh* const baseId 0138 , const char* const systemId 0139 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 0140 ); 0141 0142 /** 0143 * This constructor is identical to the third constructor above, except that 0144 * it accepts the relative and public ids as local code page strings and just 0145 * transcodes them internally, as a convenience. 0146 * 0147 * @param baseId The base system id URL which provides the base 0148 * for any relative id part. 0149 * 0150 * @param systemId The possibly relative system id URL. If its relative 0151 * its based on baseId, else its taken as is. 0152 * 0153 * @param publicId The optional public id to set. This is just passed 0154 * on to the parent class for storage. 0155 * on to the parent class for storage. 0156 * 0157 * @param manager Pointer to the memory manager to be used to 0158 * allocate objects. 0159 */ 0160 URLInputSource 0161 ( 0162 const XMLCh* const baseId 0163 , const char* const systemId 0164 , const char* const publicId 0165 , MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager 0166 ); 0167 0168 //@} 0169 0170 /** @name Destructor */ 0171 //@{ 0172 ~URLInputSource(); 0173 //@} 0174 0175 0176 // ----------------------------------------------------------------------- 0177 // Virtual input source interface 0178 // ----------------------------------------------------------------------- 0179 0180 /** @name Virtual methods */ 0181 //@{ 0182 0183 /** 0184 * This method will return a binary input stream derivative that will 0185 * parse from the source referred to by the URL system id. 0186 */ 0187 BinInputStream* makeStream() const; 0188 0189 //@} 0190 0191 0192 // ----------------------------------------------------------------------- 0193 // Getter methods 0194 // ----------------------------------------------------------------------- 0195 0196 /** @name Getter methods */ 0197 //@{ 0198 0199 /** 0200 * This method will return a const reference to the URL member which 0201 * contains the system id in pre-parsed URL form. If you just want the 0202 * string format, call getSystemId() on the parent class. 0203 * 0204 * @return A const reference to a URL object that contains the current 0205 * system id set for this input source. 0206 */ 0207 const XMLURL& urlSrc() const; 0208 0209 //@} 0210 0211 0212 private : 0213 // ----------------------------------------------------------------------- 0214 // Unimplemented constructors and operators 0215 // ----------------------------------------------------------------------- 0216 URLInputSource(const URLInputSource&); 0217 URLInputSource& operator=(const URLInputSource&); 0218 0219 // ----------------------------------------------------------------------- 0220 // Private data members 0221 // 0222 // fURL 0223 // This is the URL created from the passed ids. 0224 // ----------------------------------------------------------------------- 0225 XMLURL fURL; 0226 }; 0227 0228 0229 inline const XMLURL& URLInputSource::urlSrc() const 0230 { 0231 return fURL; 0232 } 0233 0234 XERCES_CPP_NAMESPACE_END 0235 0236 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |