source: icXML/icXML-devel/src/xercesc/internal/XMLScannerResolver.cpp @ 2722

Last change on this file since 2722 was 2722, checked in by cameron, 6 years ago

Original Xerces files with import mods for icxercesc

File size: 4.2 KB
Line 
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements.  See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License.  You may obtain a copy of the License at
8 *
9 *      http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id: XMLScannerResolver.cpp 471747 2006-11-06 14:31:56Z amassari $
20 */
21
22
23// ---------------------------------------------------------------------------
24//  Includes
25// ---------------------------------------------------------------------------
26#include <xercesc/internal/XMLScannerResolver.hpp>
27#include <icxercesc/internal/WFXMLScanner.hpp>
28#include <icxercesc/internal/DGXMLScanner.hpp>
29#include <icxercesc/internal/SGXMLScanner.hpp>
30#include <icxercesc/internal/IGXMLScanner.hpp>
31
32XERCES_CPP_NAMESPACE_BEGIN
33
34// ---------------------------------------------------------------------------
35//  XMLScannerResolver: Public static methods
36// ---------------------------------------------------------------------------
37XMLScanner*
38XMLScannerResolver::getDefaultScanner( XMLValidator* const  valToAdopt
39                                     , GrammarResolver* const grammarResolver
40                                     , MemoryManager* const manager)
41{
42    return new (manager) IGXMLScanner(valToAdopt, grammarResolver, manager);
43}
44
45XMLScanner*
46XMLScannerResolver::resolveScanner( const XMLCh* const   scannerName
47                                  , XMLValidator* const  valToAdopt
48                                  , GrammarResolver* const grammarResolver
49                                  , MemoryManager* const manager)
50{
51    if (XMLString::equals(scannerName, XMLUni::fgWFXMLScanner))
52        return new (manager) WFXMLScanner(valToAdopt, grammarResolver, manager);
53    else if (XMLString::equals(scannerName, XMLUni::fgIGXMLScanner))
54        return new (manager) IGXMLScanner(valToAdopt, grammarResolver, manager);
55    else if (XMLString::equals(scannerName, XMLUni::fgSGXMLScanner))
56        return new (manager) SGXMLScanner(valToAdopt, grammarResolver, manager);
57    else if (XMLString::equals(scannerName, XMLUni::fgDGXMLScanner))
58        return new (manager) DGXMLScanner(valToAdopt, grammarResolver, manager);
59
60    // REVISIT: throw an exception or return a default one?
61    return 0;
62}
63
64XMLScanner*
65XMLScannerResolver::resolveScanner( const XMLCh* const        scannerName
66                                  , XMLDocumentHandler* const docHandler
67                                  , DocTypeHandler* const     docTypeHandler
68                                  , XMLEntityHandler* const   entityHandler
69                                  , XMLErrorReporter* const   errReporter
70                                  , XMLValidator* const       valToAdopt
71                                  , GrammarResolver* const    grammarResolver
72                                  , MemoryManager* const      manager)
73{
74    if (XMLString::equals(scannerName, XMLUni::fgWFXMLScanner))
75        return new (manager) WFXMLScanner(docHandler, docTypeHandler, entityHandler, errReporter, valToAdopt, grammarResolver, manager);
76    else if (XMLString::equals(scannerName, XMLUni::fgIGXMLScanner))
77        return new (manager) IGXMLScanner(docHandler, docTypeHandler, entityHandler, errReporter, valToAdopt, grammarResolver, manager);
78    else if (XMLString::equals(scannerName, XMLUni::fgSGXMLScanner))
79        return new (manager) SGXMLScanner(docHandler, docTypeHandler, entityHandler, errReporter, valToAdopt, grammarResolver, manager);
80    else if (XMLString::equals(scannerName, XMLUni::fgDGXMLScanner))
81        return new (manager) DGXMLScanner(docHandler, docTypeHandler, entityHandler, errReporter, valToAdopt, grammarResolver, manager);
82
83    // REVISIT: throw an exception or return a default one?
84    return 0;
85}
86
87
88XERCES_CPP_NAMESPACE_END
Note: See TracBrowser for help on using the repository browser.