1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
#include "transformer_facade.h"
#include <xalanc/PlatformSupport/XalanOutputStreamPrintWriter.hpp>
#include <xalanc/PlatformSupport/XalanStdOutputStream.hpp>
#include <xalanc/XMLSupport/FormatterToXML.hpp>
#include <xalanc/XercesParserLiaison/FormatterToXercesDOM.hpp>
#include <xalanc/XMLSupport/FormatterTreeWalker.hpp>
#include <xalanc/XercesParserLiaison/XercesParserLiaison.hpp>
#include <xalanc/XercesParserLiaison/XercesDOMSupport.hpp>
#include <xalanc/XalanTransformer/XercesDOMWrapperParsedSource.hpp>
#include <xercesc/dom/DOMDocument.hpp>
#include <xercesc/dom/DOMImplementation.hpp>
#include "support/xerces_string_guard.h"
namespace InputXSLT {
TransformerFacade::TransformerFacade(IncludeEntityResolver* resolver):
transformer_(),
error_multiplexer_(&transformer_),
warning_capacitor_(&error_multiplexer_) {
this->transformer_.setEntityResolver(resolver);
}
WarningCapacitor::warning_cache_ptr TransformerFacade::getCachedWarnings() {
return this->warning_capacitor_.discharge();
}
void TransformerFacade::generate(
const xalan::XSLTInputSource& source,
const xalan::XSLTInputSource& transformation,
xalan::FormatterListener& target
) {
if ( source.getNode() == nullptr ) {
ErrorCapacitor errorCapacitor(&this->error_multiplexer_);
this->transformer_.transform(
source,
transformation,
target
);
errorCapacitor.discharge();
} else {
this->generate(
source.getNode(),
transformation,
target
);
}
}
void TransformerFacade::generate(
const xalan::XSLTInputSource& transformation,
xalan::FormatterListener& target
) {
ErrorCapacitor errorCapacitor(&this->error_multiplexer_);
xercesc::DOMDocument* const inputDocument(
xercesc::DOMImplementation::getImplementation()->createDocument(
nullptr,
*XercesStringGuard<XMLCh>("dummy"),
nullptr
)
);
xalan::XercesParserLiaison parserLiaison;
xalan::XercesDOMSupport domSupport(parserLiaison);
xalan::XercesDOMWrapperParsedSource inputParsedSource(
inputDocument,
parserLiaison,
domSupport
);
this->transformer_.transform(
inputParsedSource,
transformation,
target
);
inputDocument->release();
errorCapacitor.discharge();
}
void TransformerFacade::generate(
xalan::XalanNode* const source,
const xalan::XSLTInputSource& transformation,
xalan::FormatterListener& target
) {
ErrorCapacitor errorCapacitor(&this->error_multiplexer_);
xercesc::DOMDocument* const inputDocument(
xercesc::DOMImplementation::getImplementation()->createDocument()
);
xalan::FormatterToXercesDOM inputFormatter(
inputDocument,
inputDocument->getDocumentElement()
);
xalan::FormatterTreeWalker walker(inputFormatter);
walker.traverseSubtree(source);
xalan::XercesParserLiaison parserLiaison;
xalan::XercesDOMSupport domSupport(parserLiaison);
xalan::XercesDOMWrapperParsedSource inputParsedSource(
inputFormatter.getDocument(),
parserLiaison,
domSupport
);
this->transformer_.transform(
inputParsedSource,
transformation,
target
);
inputDocument->release();
errorCapacitor.discharge();
}
}
|