1 |
Douglas Thrift |
126 |
// Site Mapper |
2 |
|
|
// |
3 |
|
|
// Douglas Thrift |
4 |
|
|
// |
5 |
|
|
// $Id$ |
6 |
|
|
|
7 |
|
|
#include "SiteMapper.hpp" |
8 |
|
|
#include "Matcher.hpp" |
9 |
Douglas Thrift |
128 |
#include "Page.hpp" |
10 |
Douglas Thrift |
126 |
|
11 |
|
|
#include <xalanc/Include/PlatformDefinitions.hpp> |
12 |
|
|
#include <xercesc/util/PlatformUtils.hpp> |
13 |
Douglas Thrift |
133 |
#include <xercesc/framework/LocalFileInputSource.hpp> |
14 |
Douglas Thrift |
126 |
#include <xalanc/XPath/XPathEvaluator.hpp> |
15 |
Douglas Thrift |
133 |
#include <xalanc/DOMSupport/XalanDocumentPrefixResolver.hpp> |
16 |
|
|
#include <xalanc/XalanSourceTree/XalanSourceTreeDOMSupport.hpp> |
17 |
|
|
#include <xalanc/XalanSourceTree/XalanSourceTreeInit.hpp> |
18 |
|
|
#include <xalanc/XalanSourceTree/XalanSourceTreeParserLiaison.hpp> |
19 |
Douglas Thrift |
126 |
|
20 |
|
|
XALAN_USING_XERCES(XMLPlatformUtils) |
21 |
Douglas Thrift |
133 |
XALAN_USING_XERCES(LocalFileInputSource) |
22 |
Douglas Thrift |
126 |
XALAN_USING_XALAN(XPathEvaluator) |
23 |
Douglas Thrift |
133 |
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 |
Douglas Thrift |
126 |
|
31 |
Douglas Thrift |
128 |
string program; |
32 |
|
|
bool debug = false; |
33 |
|
|
|
34 |
Douglas Thrift |
126 |
int main(int argc, char* argv[]) |
35 |
|
|
{ |
36 |
Douglas Thrift |
128 |
program = argv[0]; |
37 |
Douglas Thrift |
132 |
|
38 |
Douglas Thrift |
126 |
string siteIndex, siteMap; |
39 |
|
|
|
40 |
Douglas Thrift |
132 |
for (int index = 1; index < argc; index++) |
41 |
Douglas Thrift |
126 |
{ |
42 |
Douglas Thrift |
128 |
string arg(argv[index]); |
43 |
|
|
Matcher matcher; |
44 |
Douglas Thrift |
126 |
|
45 |
Douglas Thrift |
128 |
if (arg == matcher("^-index=(.*)$")) |
46 |
|
|
{ |
47 |
|
|
siteIndex = matcher[1]; |
48 |
|
|
} |
49 |
|
|
else if (arg == matcher("^-map=(.*)$")) |
50 |
|
|
{ |
51 |
|
|
siteMap = matcher[1]; |
52 |
|
|
} |
53 |
Douglas Thrift |
133 |
else if (arg == "-D") |
54 |
|
|
{ |
55 |
|
|
if (!debug) debug = true; |
56 |
|
|
} |
57 |
Douglas Thrift |
126 |
} |
58 |
|
|
|
59 |
Douglas Thrift |
128 |
if (siteIndex != "" && siteMap != "") |
60 |
Douglas Thrift |
132 |
{ |
61 |
Douglas Thrift |
128 |
XMLPlatformUtils::Initialize(); |
62 |
|
|
XPathEvaluator::initialize(); |
63 |
Douglas Thrift |
126 |
|
64 |
Douglas Thrift |
128 |
SiteMapper mapper(siteIndex, siteMap); |
65 |
|
|
|
66 |
|
|
XPathEvaluator::terminate(); |
67 |
|
|
XMLPlatformUtils::Terminate(); |
68 |
|
|
} |
69 |
|
|
else |
70 |
|
|
{ |
71 |
Douglas Thrift |
133 |
cout << "Usage: " << program << " -index=index -map=map [-D]\n"; |
72 |
Douglas Thrift |
128 |
} |
73 |
Douglas Thrift |
129 |
|
74 |
Douglas Thrift |
126 |
return 0; |
75 |
|
|
} |
76 |
|
|
|
77 |
|
|
SiteMapper::SiteMapper(const string& siteIndex, const string& siteMap) |
78 |
|
|
{ |
79 |
Douglas Thrift |
133 |
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 |
Douglas Thrift |
126 |
// |
107 |
|
|
} |
108 |
Douglas Thrift |
133 |
|
109 |
|
|
void SiteMapper::newMap(const string& siteMap) |
110 |
|
|
{ |
111 |
|
|
// |
112 |
|
|
} |