[jdom-interest] Text nodes

guru at stinky.com guru at stinky.com
Thu Jul 12 13:17:46 PDT 2001


Brett sez:
> I see this as correct behavior, even more so when we have a Text node, which
> is coming soon.

Oh, God, a Text node! 

That will wreak havoc on the meaning of getText() and setText()!

Our carefully crafted compromise, out the window...

With a Text node, the content of even a "simple" text-only node could
be many Text nodes in a list.  But if getText() returns a String, not
a Text, it'll be confusing.  Not to mention setText(String)
vs. setText(Text)...

And then, what if we want a method that returns only child text nodes
in a list, like getChildren returns only element nodes in a list?
Should it be called getTexts() ?  Ugh.

Maybe get/setText should be renamed get/setString.  Or 

 String getString()
 void setContent(String)
 void setContent(Text)

and we remove get/setText altogether...

Sigh.

 - A

P.S. I actually think a Text node is a very good idea -- always seemed
odd to me to have Strings mixed in with org.jdom objects -- it just
makes nomenclature a little odd.

-- 
Alex Chaffee                       mailto:alex at jguru.com
jGuru - Java News and FAQs         http://www.jguru.com/alex/
Creator of Gamelan                 http://www.gamelan.com/
Founder of Purple Technology       http://www.purpletech.com/
Curator of Stinky Art Collective   http://www.stinky.com/



More information about the jdom-interest mailing list