projects
/
org.ibex.xt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
finished updating xt for new JS API
[org.ibex.xt.git]
/
src
/
org
/
ibex
/
xt
/
Node.java
diff --git
a/src/org/ibex/xt/Node.java
b/src/org/ibex/xt/Node.java
index
3f8b2c2
..
04e7ee6
100644
(file)
--- 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;
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;
n.delta = xml.getDepth() - currentdelta;
currentdelta = xml.getDepth();
return true;
@@
-139,7
+139,11
@@
public class Node {
} catch (Exception e) { throw new RuntimeException(e); } }
}
} 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) {
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(">");
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("</");
w.write(name);
w.write(">");
w.write("</");
w.write(name);
w.write(">");