|
|
|||
Warning, file /include/xercesc/util/XMLResourceIdentifier.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
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_XMLRESOURCEIDENTIFIER_HPP) 0023 #define XERCESC_INCLUDE_GUARD_XMLRESOURCEIDENTIFIER_HPP 0024 0025 XERCES_CPP_NAMESPACE_BEGIN 0026 0027 class Locator; 0028 0029 /** 0030 * <p>This class is used along with XMLEntityResolver to resolve entities. 0031 * Instead of passing publicId and systemId on the resolveEntity call, 0032 * as is done with the SAX entity resolver, an object of type XMLResourceIdentifier 0033 * is passed. By calling the getResourceIdentifierType() method the user can 0034 * determine which data members are available for inspection:</p> 0035 * 0036 * <table border='1'> 0037 * <tr> 0038 * <td>ResourceIdentifierType</td> 0039 * <td>Available Data Members</td> 0040 * </tr> 0041 * <tr> 0042 * <td>SchemaGrammar</td> 0043 * <td>schemaLocation, nameSpace & baseURI (current document)</td> 0044 * </tr> 0045 * <tr> 0046 * <td>SchemaImport</td> 0047 * <td>schemaLocation, nameSpace & baseURI (current document)</td> 0048 * </tr> 0049 * <tr> 0050 * <td>SchemaInclude</td> 0051 * <td>schemaLocation & baseURI (current document)</td> 0052 * </tr> 0053 * <tr> 0054 * <td>SchemaRedefine</td> 0055 * <td>schemaLocation & baseURI (current document)</td> 0056 * </tr> 0057 * <tr> 0058 * <td>ExternalEntity</td> 0059 * <td>systemId, publicId & baseURI (some items may be NULL)</td> 0060 * </tr> 0061 * </table> 0062 * 0063 * <p>The following resolver would provide the application 0064 * with a special character stream for the entity with the system 0065 * identifier "http://www.myhost.com/today":</p> 0066 * 0067 *<code> 0068 * \#include <xercesc/util/XMLEntityResolver.hpp><br> 0069 * \#include <xercesc/sax/InputSource.hpp><br> 0070 *<br> 0071 * class MyResolver : public XMLEntityResolver {<br> 0072 * public:<br> 0073 * InputSource* resolveEntity (XMLResourceIdentifier* xmlri);<br> 0074 * ...<br> 0075 * };<br> 0076 *<br> 0077 * MyResolver::resolveEntity(XMLResourceIdentifier* xmlri) {<br> 0078 * switch(xmlri->getResourceIdentifierType()) {<br> 0079 * case XMLResourceIdentifier::SystemId:<br> 0080 * if (XMLString::compareString(xmlri->getSystemId(), "http://www.myhost.com/today")) {<br> 0081 * MyReader* reader = new MyReader();<br> 0082 * return new InputSource(reader);<br> 0083 * } else {<br> 0084 * return null;<br> 0085 * }<br> 0086 * break;<br> 0087 * default:<br> 0088 * return null;<br> 0089 * }<br> 0090 * }</code> 0091 * 0092 * @see SAXParser#setXMLEntityResolver 0093 * @see InputSource#InputSource 0094 */ 0095 class XMLUTIL_EXPORT XMLResourceIdentifier 0096 { 0097 public: 0098 0099 /** @name Public Constants */ 0100 //@{ 0101 enum ResourceIdentifierType { 0102 SchemaGrammar = 0, 0103 SchemaImport, 0104 SchemaInclude, 0105 SchemaRedefine , 0106 ExternalEntity, 0107 UnKnown = 255 0108 }; 0109 //@} 0110 0111 /** @name Constructors and Destructor */ 0112 //@{ 0113 /** Constructor */ 0114 0115 XMLResourceIdentifier(const ResourceIdentifierType resourceIdentitiferType 0116 , const XMLCh* const systemId 0117 , const XMLCh* const nameSpace = 0 0118 , const XMLCh* const publicId = 0 0119 , const XMLCh* const baseURI = 0 0120 , const Locator* locator = 0); 0121 0122 /** Destructor */ 0123 ~XMLResourceIdentifier() 0124 { 0125 } 0126 0127 //@} 0128 0129 // ----------------------------------------------------------------------- 0130 // Getter methods 0131 // ----------------------------------------------------------------------- 0132 /** @name Public Methods */ 0133 //@{ 0134 ResourceIdentifierType getResourceIdentifierType() const; 0135 const XMLCh* getPublicId() const; 0136 const XMLCh* getSystemId() const; 0137 const XMLCh* getSchemaLocation() const; 0138 const XMLCh* getBaseURI() const; 0139 const XMLCh* getNameSpace() const; 0140 const Locator* getLocator() const; 0141 //@} 0142 0143 private : 0144 0145 const ResourceIdentifierType fResourceIdentifierType; 0146 const XMLCh* fPublicId; 0147 const XMLCh* fSystemId; 0148 const XMLCh* fBaseURI; 0149 const XMLCh* fNameSpace; 0150 const Locator* fLocator; 0151 0152 /* Unimplemented constructors and operators */ 0153 0154 /* Copy constructor */ 0155 XMLResourceIdentifier(const XMLResourceIdentifier&); 0156 0157 /* Assignment operator */ 0158 XMLResourceIdentifier& operator=(const XMLResourceIdentifier&); 0159 0160 }; 0161 0162 inline XMLResourceIdentifier::ResourceIdentifierType XMLResourceIdentifier::getResourceIdentifierType() const 0163 { 0164 return fResourceIdentifierType; 0165 } 0166 0167 inline const XMLCh* XMLResourceIdentifier::getPublicId() const 0168 { 0169 return fPublicId; 0170 } 0171 0172 inline const XMLCh* XMLResourceIdentifier::getSystemId() const 0173 { 0174 return fSystemId; 0175 } 0176 0177 inline const XMLCh* XMLResourceIdentifier::getSchemaLocation() const 0178 { 0179 return fSystemId; 0180 } 0181 0182 inline const XMLCh* XMLResourceIdentifier::getBaseURI() const 0183 { 0184 return fBaseURI; 0185 } 0186 0187 inline const XMLCh* XMLResourceIdentifier::getNameSpace() const 0188 { 0189 return fNameSpace; 0190 } 0191 0192 inline const Locator* XMLResourceIdentifier::getLocator() const 0193 { 0194 return fLocator; 0195 } 0196 0197 inline XMLResourceIdentifier::XMLResourceIdentifier(const ResourceIdentifierType resourceIdentifierType 0198 , const XMLCh* const systemId 0199 , const XMLCh* const nameSpace 0200 , const XMLCh* const publicId 0201 , const XMLCh* const baseURI 0202 , const Locator* locator ) 0203 : fResourceIdentifierType(resourceIdentifierType) 0204 , fPublicId(publicId) 0205 , fSystemId(systemId) 0206 , fBaseURI(baseURI) 0207 , fNameSpace(nameSpace) 0208 , fLocator(locator) 0209 { 0210 } 0211 0212 XERCES_CPP_NAMESPACE_END 0213 0214 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|