X-Git-Url: http://git.megacz.com/?p=org.ibex.xt.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fxt%2FNode.java;fp=src%2Forg%2Fibex%2Fxt%2FNode.java;h=04e7ee6845a0697ebb1d96cd861528f6ffecca2b;hp=3f8b2c2c28c17d0c9786df66a60f27a459219b33;hb=ef26083dc84f06010099ecee9caec22df3b3e114;hpb=f373d876ecdaaf563afbc4f7d11211ba7d5d2af6 diff --git a/src/org/ibex/xt/Node.java b/src/org/ibex/xt/Node.java index 3f8b2c2..04e7ee6 100644 --- a/src/org/ibex/xt/Node.java +++ b/src/org/ibex/xt/Node.java @@ -118,8 +118,8 @@ public class Node { protected boolean _read(Node n) { try { Object ret = xml.next(); if (ret == null) return false; - if (ret instanceof String) { - n.cdata = (String)ret; + if (ret instanceof XML.Text) { + n.cdata = ((XML.Text)ret).t; n.delta = xml.getDepth() - currentdelta; currentdelta = xml.getDepth(); return true; @@ -139,7 +139,11 @@ public class Node { } catch (Exception e) { throw new RuntimeException(e); } } } - public void toXML(Writer writer) throws IOException { Node n = new Node(); if (read(n)) toXML(writer, n); } + public void toXML(Writer writer) throws IOException { + Node n = new Node(); + do { if (!read(n)) n = null; } while (n!=null && n.cdata != null); + toXML(writer, n); + } private Node toXML(Writer w, Node n) throws IOException { final String name = n.name; if (n.cdata != null) { @@ -160,7 +164,7 @@ public class Node { w.write("/>"); } else { w.write(">"); - while(n != null && n.delta > 0) n = toXML(w, n); + while(n != null && n.delta > 0) { n = toXML(w, n); } w.write("");