01: package org.ontoware.aifbcommons.xml;
02:
03: import java.io.IOException;
04: import java.io.InputStream;
05:
06: import org.dom4j.Document;
07: import org.dom4j.DocumentException;
08: import org.junit.Assert;
09: import org.junit.Test;
10: import org.xmlpull.v1.XmlPullParserException;
11:
12: /**
13: * @author mvo
14: *
15: */
16: public class XMLUtilsTest {
17:
18: @Test
19: public void testXmldecode() throws DocumentException, IOException,
20: XmlPullParserException {
21:
22: ClassLoader classloader = Thread.currentThread()
23: .getContextClassLoader();
24: InputStream in = classloader
25: .getResourceAsStream("sample-wikipage-in.xml");
26:
27: Document doc = XMLUtils.getAsXML(in);
28:
29: String xml = doc.asXML();
30:
31: String encoded = XMLUtils.xmlencode(xml);
32:
33: String decoded = XMLUtils.xmldecode(encoded);
34:
35: Assert.assertEquals(xml, decoded);
36: }
37:
38: }
|