1
public class Canon_2219Impl extends BaseCrawler{
2
public Transformer transformer = null;
3
public XPath xpath = null;
4

.
5
6
public Canon_2219Impl(){
7
xpath = XPathFactory.newInstance().newXPath();
8
try{
9
transformer = TransformerFactory.newInstance().newTransformer();
10
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
11
transformer.setOutputProperty(OutputKeys.METHOD, "xml");
12
transformer.setOutputProperty(OutputKeys.ENCODING,"ISO-8859-1");
13
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
14
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
15
}catch(Exception e){
16
e.printStackTrace();
17
}
18
19
}
20
21
22
//change node to string
23
protected String asXml(Node node) throws Exception {
24
if(node == null){
25
return null;
26
}
27
DOMSource domSource = new DOMSource(node);
28
java.io.StringWriter sw = new java.io.StringWriter();
29
StreamResult sr = new StreamResult(sw);
30
this.transformer.transform(domSource, sr);
31
String xml = sw.toString();
32
return xml;
33
}
34
}
35
36

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
