Re: cloning nodes vs. creating new() ones

Jacob Kjome <[email protected]> Tue, 16 Sep 2003 09:55:09 -0500
Newsgroups gmane.comp.java.enhydra.xmlc
Message-ID <[email protected]>
At 10:43 AM 9/16/2003 +0200, you wrote:
>Use the generated method "setTextTeacherName(String)". This sets the content
>of the first descendant of the node with id "teacherName". In your example,
>thats the first child (i.e. the same node you are using), but the difference
>is that "setText....()" doesn't break the template if e.g. the designer
>decides to make the text bold.

One other option that Mathew can use is XMLCUtil.findFirstText(Node) to get 
the first text child of a node whether it be the first child or 
deeper.  This also allows one to avoid breaking things even if the designer 
adds extra tags like <b>.  However, it still isn't quite as good as using 
setTextTeacherName(String) which allows you to validate things at compile 
time, rather than waiting for a runtime error if it doesn't exist.

Jake