Credit and test for #636
This commit is contained in:
parent
77109cb76b
commit
78643981f6
|
@ -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 = "<div>α</div>";
|
||||||
|
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("<div xmlns=\"http://www.w3.org/1999/xhtml\">α</div>", node.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See #636
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testParseLiteralByDecimal() throws Exception {
|
||||||
|
String input = "<div>α</div>";
|
||||||
|
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("<div xmlns=\"http://www.w3.org/1999/xhtml\">α</div>", node.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See #636
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testParseLiteralByHex() throws Exception {
|
||||||
|
String input = "<div>α</div>";
|
||||||
|
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("<div xmlns=\"http://www.w3.org/1999/xhtml\">α</div>", node.getValue());
|
||||||
|
}
|
||||||
|
}
|
|
@ -121,6 +121,10 @@
|
||||||
AppacheHttpClient did not always respect the charset in the response
|
AppacheHttpClient did not always respect the charset in the response
|
||||||
Content-Type header. Thanks to Gijsbert van den Brink for the pull request!
|
Content-Type header. Thanks to Gijsbert van den Brink for the pull request!
|
||||||
</action>
|
</action>
|
||||||
|
<action type="fix" issue="636">
|
||||||
|
Fix XhtmlParser to correctly handle hexadecimal escaped literals. Thanks to
|
||||||
|
Gijsbert van den Brink for the Pull Request!
|
||||||
|
</action>
|
||||||
</release>
|
</release>
|
||||||
<release version="2.4" date="2017-04-19">
|
<release version="2.4" date="2017-04-19">
|
||||||
<action type="add">
|
<action type="add">
|
||||||
|
|
Loading…
Reference in New Issue