KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtworks > xstream > io > xml > Dom4JDriver


1 package com.thoughtworks.xstream.io.xml;
2
3 import com.thoughtworks.xstream.io.HierarchicalStreamDriver;
4 import com.thoughtworks.xstream.io.HierarchicalStreamReader;
5 import com.thoughtworks.xstream.io.StreamException;
6 import org.dom4j.Document;
7 import org.dom4j.DocumentException;
8 import org.dom4j.io.SAXReader;
9
10 import java.io.Reader JavaDoc;
11
12 public class Dom4JDriver implements HierarchicalStreamDriver {
13     public HierarchicalStreamReader createReader(Reader text) {
14         try {
15             SAXReader reader = new SAXReader();
16             Document document = reader.read(text);
17             return new Dom4JReader(document);
18         } catch (DocumentException e) {
19             throw new StreamException(e);
20         }
21     }
22
23 }
24
Popular Tags