File tree Expand file tree Collapse file tree
main/java/edu/cmu/oli/content/resource/builders
test/java/edu/cmu/oli/content/resource/builders Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66import edu .cmu .oli .content .AppUtils ;
77import org .apache .commons .text .StringEscapeUtils ;
88import org .jdom2 .*;
9- import org .slf4j .Logger ;
10- import org .slf4j .LoggerFactory ;
119
1210import java .util .ArrayList ;
1311import java .util .List ;
1917 */
2018public class Json2Xml {
2119
22- private Logger log = LoggerFactory .getLogger (Json2Xml .class );
23-
2420 public Document jsonToXml (JsonObject json , Map <String , Namespace > namespaceMap ) {
2521 Document document = new Document ();
2622
Original file line number Diff line number Diff line change @@ -27,15 +27,17 @@ public String afterDocToString(final String str) {
2727 assertTrue (str .contains ("<p>1 2 3</p>" ));
2828 assertTrue (str .contains ("<p>4 5 6</p>" ));
2929
30+ System .out .println (str );
3031 // check newlines retained in preformatted codeblocks
3132 Matcher regex = Pattern .compile (
32- "<codeblock syntax\\ =\" xml\" >7$\\ s+8$\\ s+9</codeblock>" ,
33+ "<codeblock syntax\\ =\" xml\" >< \\ ! \\ [CDATA \\ [ 7$\\ s+8$\\ s+9\\ ] \\ ]> </codeblock>" ,
3334 Pattern .DOTALL | Pattern .MULTILINE
3435 ).matcher (str );
3536 assertTrue ("XML contains 7\\ n 8\\ n 9" , regex .find ());
3637
38+
3739 regex = Pattern .compile (
38- "<codeblock syntax\\ =\" xml\" >$\\ s+10$\\ s+11$\\ s+12</codeblock>" ,
40+ "<codeblock syntax\\ =\" xml\" >< \\ ! \\ [CDATA \\ [ $\\ s+10$\\ s+11$\\ s+12\\ ] \\ ]> </codeblock>" ,
3941 Pattern .DOTALL | Pattern .MULTILINE
4042 ).matcher (str );
4143 assertTrue ("XML contains \\ n 10\\ n 11\\ n 12" , regex .find ());
You can’t perform that action at this time.
0 commit comments