Merge pull request #170 from johngrimes/xhtmlnode-location-serializable
Make XhtmlNode$Location serializable
This commit is contained in:
commit
d935dac0d9
|
@ -50,6 +50,7 @@ package org.hl7.fhir.utilities.xhtml;
|
||||||
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -67,7 +68,8 @@ public class XhtmlNode implements IBaseXhtml {
|
||||||
private static final long serialVersionUID = -4362547161441436492L;
|
private static final long serialVersionUID = -4362547161441436492L;
|
||||||
|
|
||||||
|
|
||||||
public static class Location {
|
public static class Location implements Serializable {
|
||||||
|
private static final long serialVersionUID = -4079302502900219721L;
|
||||||
private int line;
|
private int line;
|
||||||
private int column;
|
private int column;
|
||||||
public Location(int line, int column) {
|
public Location(int line, int column) {
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
package org.hl7.fhir.utilities.tests;
|
package org.hl7.fhir.utilities.tests;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.ObjectOutputStream;
|
||||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -71,4 +74,13 @@ public class XhtmlNodeTest {
|
||||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\"><img src=\"http://pbs.twimg.com/profile_images/544507893991485440/r_vo3uj2_bigger.png\" alt=\"Twitter Avatar\"/>@fhirabend</div>", output);
|
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\"><img src=\"http://pbs.twimg.com/profile_images/544507893991485440/r_vo3uj2_bigger.png\" alt=\"Twitter Avatar\"/>@fhirabend</div>", output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSerializable() throws IOException {
|
||||||
|
XhtmlNode node = new XhtmlNode();
|
||||||
|
node.setValueAsString("<?xml version=\"1.0\" encoding=\"UTF-8\"?><div xmlns=\"http://www.w3.org/1999/xhtml\">Test</div>");
|
||||||
|
|
||||||
|
ByteArrayOutputStream bout = new ByteArrayOutputStream();
|
||||||
|
ObjectOutputStream oout = new ObjectOutputStream(bout);
|
||||||
|
oout.writeObject(node);
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue