source: trunk/VUT/GtpVisibilityPreprocessor/support/xercesc/util/XMLResourceIdentifier.hpp @ 188

Revision 188, 8.4 KB checked in by mattausch, 19 years ago (diff)

added xercesc to support

Line 
1/*
2 * The Apache Software License, Version 1.1
3 *
4 * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
5 * reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 *
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 *
14 * 2. Redistributions in binary form must reproduce the above copyright
15 *    notice, this list of conditions and the following disclaimer in
16 *    the documentation and/or other materials provided with the
17 *    distribution.
18 *
19 * 3. The end-user documentation included with the redistribution,
20 *    if any, must include the following acknowledgment:
21 *       "This product includes software developed by the
22 *        Apache Software Foundation (http://www.apache.org/)."
23 *    Alternately, this acknowledgment may appear in the software itself,
24 *    if and wherever such third-party acknowledgments normally appear.
25 *
26 * 4. The names "Xerces" and "Apache Software Foundation" must
27 *    not be used to endorse or promote products derived from this
28 *    software without prior written permission. For written
29 *    permission, please contact apache\@apache.org.
30 *
31 * 5. Products derived from this software may not be called "Apache",
32 *    nor may "Apache" appear in their name, without prior written
33 *    permission of the Apache Software Foundation.
34 *
35 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38 * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46 * SUCH DAMAGE.
47 * ====================================================================
48 *
49 * This software consists of voluntary contributions made by many
50 * individuals on behalf of the Apache Software Foundation, and was
51 * originally based on software copyright (c) 1999, International
52 * Business Machines, Inc., http://www.ibm.com .  For more information
53 * on the Apache Software Foundation, please see
54 * <http://www.apache.org/>.
55 */
56
57/*
58 * $Log: XMLResourceIdentifier.hpp,v $
59 * Revision 1.5  2004/02/15 19:37:16  amassari
60 * Removed cause for warnings in VC 7.1
61 *
62 * Revision 1.4  2004/02/13 14:28:30  cargilld
63 * Fix for bug 26900 (remove virtual on destructor)
64 *
65 * Revision 1.3  2004/01/29 11:48:47  cargilld
66 * Code cleanup changes to get rid of various compiler diagnostic messages.
67 *
68 * Revision 1.2  2003/11/25 18:16:38  knoaman
69 * Documentation update. Thanks to David Cargill.
70 *
71 * Revision 1.1  2003/10/30 21:37:32  knoaman
72 * Enhanced Entity Resolver Support. Thanks to David Cargill.
73 *
74 *
75 * Revision 1.1    1999/11/09 01:07:44  twl
76 * Initial checkin
77 *
78 */
79
80#ifndef XMLRESOURCEIDENTIFIER_HPP
81#define XMLRESOURCEIDENTIFIER_HPP
82
83XERCES_CPP_NAMESPACE_BEGIN
84
85/**
86  * <p>This class is used along with XMLEntityResolver to resolve entities.
87  * Instead of passing publicId and systemId on the resolveEntity call,
88  * as is done with the SAX entity resolver, an object of type XMLResourceIdentifier
89  * is passed.  By calling the getResourceIdentifierType() method the user can
90  * determine which data members are available for inspection:</p>
91  *
92  * <table border='1'>
93  * <tr>
94  *  <td>ResourceIdentifierType</td>
95  *  <td>Available Data Members</td>
96  * </tr>
97  * <tr>
98  *  <td>SchemaGrammar</td>
99  *  <td>schemaLocation, nameSpace & baseURI (current document)</td>
100  * </tr>
101  * <tr>
102  *  <td>SchemaImport</td>
103  *  <td>schemaLocation, nameSpace & baseURI (current document)</td>
104  * </tr>
105  * <tr>
106  *  <td>SchemaInclude</td>
107  *  <td>schemaLocation & baseURI (current document)</td>
108  * </tr>
109  * <tr>
110  *  <td>SchemaRedefine</td>
111  *  <td>schemaLocation & baseURI (current document)</td>
112  * </tr>
113  * <tr>
114  *  <td>ExternalEntity</td>
115  *  <td>systemId, publicId & baseURI (some items may be NULL)</td>
116  * </tr>
117  * </table>
118  *
119  * <p>The following resolver would provide the application
120  * with a special character stream for the entity with the system
121  * identifier "http://www.myhost.com/today":</p>
122  *
123  *<pre>
124  * #include <xercesc/util/XMLEntityResolver.hpp>
125  * #include <xercesc/sax/InputSource.hpp>
126  *
127  * class MyResolver : public XMLEntityResolver {
128  *  public:
129  *    InputSource resolveEntity (XMLResourceIdentifier* xmlri);
130  *   ...
131  *   };
132  *
133  *  MyResolver::resolveEntity(XMLResourceIdentifier* xmlri) {
134  *    switch(xmlri->getResourceIdentifierType()) {
135  *      case XMLResourceIdentifier::SystemId:
136  *        if (XMLString::compareString(xmlri->getSystemId(), "http://www.myhost.com/today")) {
137  *          MyReader* reader = new MyReader();
138  *          return new InputSource(reader);
139  *        } else {
140  *          return null;
141  *        }
142  *        break;
143  *      default:
144  *        return null;
145  *    }
146  *  }</pre>
147  *
148  * @see SAXParser#setXMLEntityResolver
149  * @see InputSource#InputSource
150  */
151class XMLUTIL_EXPORT XMLResourceIdentifier
152{
153public:
154
155    enum ResourceIdentifierType {
156        SchemaGrammar = 0,
157        SchemaImport,
158        SchemaInclude,
159        SchemaRedefine ,
160        ExternalEntity,
161        UnKnown = 255
162    //@{
163    };
164
165    /** @name Constructors and Destructor */
166
167    /** Constructor */
168
169    XMLResourceIdentifier(const ResourceIdentifierType resourceIdentitiferType
170                            , const XMLCh* const  systemId
171                            , const XMLCh* const  nameSpace = 0
172                            , const XMLCh* const  publicId = 0
173                            , const XMLCh* const  baseURI = 0);
174
175    /** Destructor */
176    ~XMLResourceIdentifier()
177    {
178    }
179
180    //@}
181
182    // -----------------------------------------------------------------------
183    //  Getter methods
184    // -----------------------------------------------------------------------
185    ResourceIdentifierType getResourceIdentifierType() const;
186    const XMLCh* getPublicId()          const;
187    const XMLCh* getSystemId()          const;
188    const XMLCh* getSchemaLocation()    const;
189    const XMLCh* getBaseURI()           const;
190    const XMLCh* getNameSpace()         const;
191
192private :
193
194    const ResourceIdentifierType    fResourceIdentifierType;
195    const XMLCh*                    fPublicId;
196    const XMLCh*                    fSystemId;
197    const XMLCh*                    fBaseURI;
198    const XMLCh*                    fNameSpace;
199
200
201    /* Unimplemented constructors and operators */
202
203    /* Copy constructor */
204    XMLResourceIdentifier(const XMLResourceIdentifier&);
205
206    /* Assignment operator */
207    XMLResourceIdentifier& operator=(const XMLResourceIdentifier&);
208
209};
210
211inline XMLResourceIdentifier::ResourceIdentifierType XMLResourceIdentifier::getResourceIdentifierType() const
212{
213    return fResourceIdentifierType;
214}
215
216inline const XMLCh* XMLResourceIdentifier::getPublicId() const
217{
218    return fPublicId;
219}
220
221inline const XMLCh* XMLResourceIdentifier::getSystemId() const
222{
223    return fSystemId;
224}
225
226inline const XMLCh* XMLResourceIdentifier::getSchemaLocation() const
227{
228    return fSystemId;
229}
230
231inline const XMLCh* XMLResourceIdentifier::getBaseURI() const
232{
233    return fBaseURI;
234}
235
236inline const XMLCh* XMLResourceIdentifier::getNameSpace() const
237{
238    return fNameSpace;
239}
240
241inline XMLResourceIdentifier::XMLResourceIdentifier(const ResourceIdentifierType resourceIdentifierType
242                            , const XMLCh* const  systemId
243                            , const XMLCh* const  nameSpace
244                            , const XMLCh* const  publicId
245                            , const XMLCh* const  baseURI )
246    : fResourceIdentifierType(resourceIdentifierType)
247    , fPublicId(publicId)
248    , fSystemId(systemId)
249    , fBaseURI(baseURI)
250    , fNameSpace(nameSpace)   
251{
252}
253
254XERCES_CPP_NAMESPACE_END
255
256#endif
Note: See TracBrowser for help on using the repository browser.