Permalink
Browse files

Fix #220 wrt EscapeMarkup

  • Loading branch information...
ndw committed Dec 15, 2016
1 parent 07eae90 commit 630eebf013c229b343afcac86cfa1292f9bab236
Showing with 9 additions and 10 deletions.
  1. +9 −10 src/main/java/com/xmlcalabash/library/EscapeMarkup.java
@@ -21,20 +21,19 @@
import com.xmlcalabash.core.XMLCalabash;
import com.xmlcalabash.core.XProcRuntime;
+import com.xmlcalabash.io.ReadablePipe;
+import com.xmlcalabash.io.WritablePipe;
+import com.xmlcalabash.runtime.XAtomicStep;
import com.xmlcalabash.util.AxisNodes;
import com.xmlcalabash.util.S9apiUtils;
import com.xmlcalabash.util.TreeWriter;
-import com.xmlcalabash.io.ReadablePipe;
-import com.xmlcalabash.io.WritablePipe;
-import net.sf.saxon.s9api.Serializer;
+import net.sf.saxon.s9api.Axis;
import net.sf.saxon.s9api.SaxonApiException;
+import net.sf.saxon.s9api.Serializer;
import net.sf.saxon.s9api.XdmNode;
-import net.sf.saxon.s9api.Axis;
import net.sf.saxon.s9api.XdmNodeKind;
-import java.io.ByteArrayOutputStream;
-
-import com.xmlcalabash.runtime.XAtomicStep;
+import java.io.StringWriter;
/**
*
@@ -90,10 +89,10 @@ public void run() throws SaxonApiException {
// Serialize the *whole* thing, then strip off the start and end tags, because
// otherwise namespace fixup messes with the namespace bindings
- ByteArrayOutputStream outstr = new ByteArrayOutputStream();
- serializer.setOutputStream(outstr);
+ StringWriter sw = new StringWriter();
+ serializer.setOutputWriter(sw);
S9apiUtils.serialize(runtime, child, serializer);
- String data = outstr.toString();
+ String data = sw.toString();
data = data.replaceAll("^<.*?>",""); // Strip off the start tag...
data = data.replaceAll("<[^<>]*?>$",""); // Strip off the end tag

0 comments on commit 630eebf

Please sign in to comment.