diff --git a/hapi-fhir-base/src/test/java/org/hl7/fhir/utilities/xhtml/XhtmlParserTest.java b/hapi-fhir-base/src/test/java/org/hl7/fhir/utilities/xhtml/XhtmlParserTest.java new file mode 100644 index 00000000000..a4f1f2a2d83 --- /dev/null +++ b/hapi-fhir-base/src/test/java/org/hl7/fhir/utilities/xhtml/XhtmlParserTest.java @@ -0,0 +1,54 @@ +package org.hl7.fhir.utilities.xhtml; + +import static org.junit.Assert.*; + +import java.io.IOException; + +import org.hl7.fhir.exceptions.FHIRFormatError; +import org.junit.Test; + +public class XhtmlParserTest { + + private XhtmlParser p = new XhtmlParser(); + /** + * See #636 + */ + @Test + public void testParseLiteralByName() throws Exception { + String input = "
α
"; + XhtmlDocument parsed = p.parse(input, null); + + assertEquals(1, parsed.getChildNodes().size()); + assertEquals(XhtmlNode.class, parsed.getChildNodes().get(0).getClass()); + XhtmlNode node = parsed.getChildNodes().get(0); + assertEquals("
α
", node.getValue()); + } + + /** + * See #636 + */ + @Test + public void testParseLiteralByDecimal() throws Exception { + String input = "
α
"; + XhtmlDocument parsed = p.parse(input, null); + + assertEquals(1, parsed.getChildNodes().size()); + assertEquals(XhtmlNode.class, parsed.getChildNodes().get(0).getClass()); + XhtmlNode node = parsed.getChildNodes().get(0); + assertEquals("
α
", node.getValue()); + } + + /** + * See #636 + */ + @Test + public void testParseLiteralByHex() throws Exception { + String input = "
α
"; + XhtmlDocument parsed = p.parse(input, null); + + assertEquals(1, parsed.getChildNodes().size()); + assertEquals(XhtmlNode.class, parsed.getChildNodes().get(0).getClass()); + XhtmlNode node = parsed.getChildNodes().get(0); + assertEquals("
α
", node.getValue()); + } +} diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 2352103db60..b2ef4f65cd4 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -121,6 +121,10 @@ AppacheHttpClient did not always respect the charset in the response Content-Type header. Thanks to Gijsbert van den Brink for the pull request! + + Fix XhtmlParser to correctly handle hexadecimal escaped literals. Thanks to + Gijsbert van den Brink for the Pull Request! +