[jdom-interest] More CDATA deletions; this time from XMLOutputter
Elliotte Rusty Harold
elharo at metalab.unc.edu
Fri Apr 19 13:34:59 PDT 2002
XMLOutputter also has a few places where it appears we could eliminate
the distinction between CDATA and Text (though here there are a few
places where it does matter).
In line 1388 we can change
if ((next instanceof CDATA) ||
(next instanceof Text)) {
to
if (next instanceof Text) {
In line 1468 we can change
if (node instanceof CDATA) {
next = ((CDATA) node).getText();
}
else {
next = ((Text) node).getText();
}
to
next = ((Text) node).getText();
In line 1699 we can change
if ( !((content.get( index) instanceof CDATA) ||
(content.get( index) instanceof Text))) {
return index;
}
to
if ( !(content.get( index) instanceof Text)) {
return index;
}
At line 1715 we can change
else if (obj instanceof CDATA) {
str = ((CDATA) obj).getText();
}
else if (obj instanceof Text) {
str = ((Text) obj).getText();
}
to just
else if (obj instanceof Text) {
str = ((Text) obj).getText();
}
Again, the net effect should just be a small simplificaiton in the code.
This should also give a minor reduction in .class size and number of
instrcutions, though I doubt it's significant.
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible, 2nd Edition (IDG Books, 2001) |
| http://www.cafeconleche.org/books/bible2/ |
| http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.cafeconleche.org/ |
+----------------------------------+---------------------------------+
More information about the jdom-interest
mailing list