1 | /*
|
---|
2 | * Copyright 1999-2000,2004 The Apache Software Foundation.
|
---|
3 | *
|
---|
4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
---|
5 | * you may not use this file except in compliance with the License.
|
---|
6 | * You may obtain a copy of the License at
|
---|
7 | *
|
---|
8 | * http://www.apache.org/licenses/LICENSE-2.0
|
---|
9 | *
|
---|
10 | * Unless required by applicable law or agreed to in writing, software
|
---|
11 | * distributed under the License is distributed on an "AS IS" BASIS,
|
---|
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
13 | * See the License for the specific language governing permissions and
|
---|
14 | * limitations under the License.
|
---|
15 | */
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * $Log: XMLReaderFactory.hpp,v $
|
---|
19 | * Revision 1.7 2004/09/08 13:56:20 peiyongz
|
---|
20 | * Apache License Version 2.0
|
---|
21 | *
|
---|
22 | * Revision 1.6 2004/01/29 11:46:32 cargilld
|
---|
23 | * Code cleanup changes to get rid of various compiler diagnostic messages.
|
---|
24 | *
|
---|
25 | * Revision 1.5 2003/06/20 18:56:45 peiyongz
|
---|
26 | * Stateless Grammar Pool :: Part I
|
---|
27 | *
|
---|
28 | * Revision 1.4 2003/05/15 18:27:11 knoaman
|
---|
29 | * Partial implementation of the configurable memory manager.
|
---|
30 | *
|
---|
31 | * Revision 1.3 2002/11/04 14:55:45 tng
|
---|
32 | * C++ Namespace Support.
|
---|
33 | *
|
---|
34 | * Revision 1.2 2002/05/07 17:45:52 knoaman
|
---|
35 | * SAX2 documentation update.
|
---|
36 | *
|
---|
37 | * Revision 1.1.1.1 2002/02/01 22:22:09 peiyongz
|
---|
38 | * sane_include
|
---|
39 | *
|
---|
40 | * Revision 1.3 2000/08/30 22:21:37 andyh
|
---|
41 | * Unix Build script fixes. Clean up some UNIX compiler warnings.
|
---|
42 | *
|
---|
43 | * Revision 1.2 2000/08/07 18:21:27 jpolast
|
---|
44 | * change SAX_EXPORT module to SAX2_EXPORT
|
---|
45 | *
|
---|
46 | * Revision 1.1 2000/08/02 18:02:35 jpolast
|
---|
47 | * initial checkin of sax2 implementation
|
---|
48 | * submitted by Simon Fell (simon@fell.com)
|
---|
49 | * and Joe Polastre (jpolast@apache.org)
|
---|
50 | *
|
---|
51 | *
|
---|
52 | */
|
---|
53 |
|
---|
54 | #ifndef XMLREADERFACTORY_HPP
|
---|
55 | #define XMLREADERFACTORY_HPP
|
---|
56 |
|
---|
57 | #include <xercesc/parsers/SAX2XMLReaderImpl.hpp>
|
---|
58 | #include <xercesc/sax/SAXException.hpp>
|
---|
59 |
|
---|
60 | XERCES_CPP_NAMESPACE_BEGIN
|
---|
61 |
|
---|
62 | class MemoryManager;
|
---|
63 | class XMLGrammarPool;
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Creates a SAX2 parser (SAX2XMLReader).
|
---|
67 | *
|
---|
68 | * <p>Note: The parser object returned by XMLReaderFactory is owned by the
|
---|
69 | * calling users, and it's the responsiblity of the users to delete that
|
---|
70 | * parser object, once they no longer need it.</p>
|
---|
71 | *
|
---|
72 | * @see SAX2XMLReader#SAX2XMLReader
|
---|
73 | */
|
---|
74 | class SAX2_EXPORT XMLReaderFactory
|
---|
75 | {
|
---|
76 | protected: // really should be private, but that causes compiler warnings.
|
---|
77 | XMLReaderFactory() ;
|
---|
78 | ~XMLReaderFactory() ;
|
---|
79 |
|
---|
80 | public:
|
---|
81 | static SAX2XMLReader * createXMLReader(
|
---|
82 | MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
|
---|
83 | , XMLGrammarPool* const gramPool = 0
|
---|
84 | ) ;
|
---|
85 | static SAX2XMLReader * createXMLReader(const XMLCh* className) ;
|
---|
86 |
|
---|
87 | private:
|
---|
88 | // -----------------------------------------------------------------------
|
---|
89 | // Unimplemented constructors and operators
|
---|
90 | // -----------------------------------------------------------------------
|
---|
91 | XMLReaderFactory(const XMLReaderFactory&);
|
---|
92 | XMLReaderFactory& operator=(const XMLReaderFactory&);
|
---|
93 | };
|
---|
94 |
|
---|
95 |
|
---|
96 | inline SAX2XMLReader * XMLReaderFactory::createXMLReader(MemoryManager* const manager
|
---|
97 | , XMLGrammarPool* const gramPool)
|
---|
98 | {
|
---|
99 | return (SAX2XMLReader*)(new (manager) SAX2XMLReaderImpl(manager, gramPool));
|
---|
100 | }
|
---|
101 |
|
---|
102 | inline SAX2XMLReader * XMLReaderFactory::createXMLReader(const XMLCh *)
|
---|
103 | {
|
---|
104 | throw SAXNotSupportedException();
|
---|
105 | // unimplemented
|
---|
106 | return 0;
|
---|
107 | }
|
---|
108 |
|
---|
109 | XERCES_CPP_NAMESPACE_END
|
---|
110 |
|
---|
111 | #endif
|
---|