1 |
// Site Mapper |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#include "SiteMapper.hpp" |
8 |
#include "Matcher.hpp" |
9 |
#include "Page.hpp" |
10 |
|
11 |
#include <xalanc/Include/PlatformDefinitions.hpp> |
12 |
#include <xercesc/util/PlatformUtils.hpp> |
13 |
#include <xercesc/framework/LocalFileInputSource.hpp> |
14 |
#include <xalanc/XPath/XPathEvaluator.hpp> |
15 |
#include <xalanc/DOMSupport/XalanDocumentPrefixResolver.hpp> |
16 |
#include <xalanc/XalanSourceTree/XalanSourceTreeDOMSupport.hpp> |
17 |
#include <xalanc/XalanSourceTree/XalanSourceTreeInit.hpp> |
18 |
#include <xalanc/XalanSourceTree/XalanSourceTreeParserLiaison.hpp> |
19 |
|
20 |
XALAN_USING_XERCES(XMLPlatformUtils) |
21 |
XALAN_USING_XERCES(LocalFileInputSource) |
22 |
XALAN_USING_XALAN(XPathEvaluator) |
23 |
XALAN_USING_XALAN(XalanDocument) |
24 |
XALAN_USING_XALAN(XalanDocumentPrefixResolver) |
25 |
XALAN_USING_XALAN(XalanDOMString) |
26 |
XALAN_USING_XALAN(XalanNode) |
27 |
XALAN_USING_XALAN(XalanSourceTreeInit) |
28 |
XALAN_USING_XALAN(XalanSourceTreeDOMSupport) |
29 |
XALAN_USING_XALAN(XalanSourceTreeParserLiaison) |
30 |
|
31 |
string program; |
32 |
bool debug = false; |
33 |
|
34 |
int main(int argc, char* argv[]) |
35 |
{ |
36 |
program = argv[0]; |
37 |
|
38 |
string siteIndex, siteMap; |
39 |
|
40 |
for (int index = 1; index < argc; index++) |
41 |
{ |
42 |
string arg(argv[index]); |
43 |
Matcher matcher; |
44 |
|
45 |
if (arg == matcher("^-index=(.*)$")) |
46 |
{ |
47 |
siteIndex = matcher[1]; |
48 |
} |
49 |
else if (arg == matcher("^-map=(.*)$")) |
50 |
{ |
51 |
siteMap = matcher[1]; |
52 |
} |
53 |
else if (arg == "-D") |
54 |
{ |
55 |
if (!debug) debug = true; |
56 |
} |
57 |
} |
58 |
|
59 |
if (siteIndex != "" && siteMap != "") |
60 |
{ |
61 |
XMLPlatformUtils::Initialize(); |
62 |
XPathEvaluator::initialize(); |
63 |
|
64 |
SiteMapper mapper(siteIndex, siteMap); |
65 |
|
66 |
XPathEvaluator::terminate(); |
67 |
XMLPlatformUtils::Terminate(); |
68 |
} |
69 |
else |
70 |
{ |
71 |
cout << "Usage: " << program << " -index=index -map=map [-D]\n"; |
72 |
} |
73 |
|
74 |
return 0; |
75 |
} |
76 |
|
77 |
SiteMapper::SiteMapper(const string& siteIndex, const string& siteMap) |
78 |
{ |
79 |
XalanSourceTreeInit init; |
80 |
|
81 |
oldMap(siteMap); |
82 |
// index(siteIndex); |
83 |
// newMap(siteMap); |
84 |
} |
85 |
|
86 |
void SiteMapper::oldMap(const string& siteMap) |
87 |
{ |
88 |
XalanSourceTreeDOMSupport support; |
89 |
XalanSourceTreeParserLiaison liaison(support); |
90 |
|
91 |
support.setParserLiaison(&liaison); |
92 |
|
93 |
cerr << "Here!\n"; |
94 |
|
95 |
const XalanDOMString file(siteMap.c_str()); |
96 |
const LocalFileInputSource source(file.c_str()); |
97 |
|
98 |
|
99 |
cerr << "There!\n"; |
100 |
|
101 |
const XalanDocument* document = liaison.parseXMLStream(source); |
102 |
} |
103 |
|
104 |
void SiteMapper::index(const string& siteIndex) |
105 |
{ |
106 |
// |
107 |
} |
108 |
|
109 |
void SiteMapper::newMap(const string& siteMap) |
110 |
{ |
111 |
// |
112 |
} |