|
Re: cloning nodes vs. creating new() ones: msg#00080java.enhydra.xmlc
Thanks, Jake. I tried to restructure my code to be more similar to what you had, but still ended up with doing it not much different than I had before. This time I populate the list of teachers from a static list: HTMLSelectElement teacherDropdown = form.getElementTeacherDropdown(); HTMLOptionElement teacherName = form.getElementTeacherName(); teacherName.removeAttribute("id"); String[] teachers = new String[] { "Mrs. Wormwood", "Mr. Snyde", "Ms. Ratchet" }; for(int i = 0;i < teachers.length;i++){ HTMLOptionElement teacherClone = (HTMLOptionElement) teacherName.cloneNode(true); teacherClone.setValue(new Integer(i).toString()); teacherClone.setLabel(teachers[i]); teacherClone.getFirstChild().setNodeValue(teachers[i]); teacherDropdown.add(teacherClone, null); } teacherDropdown.removeChild(teacherName); I still can't seem to get away from using getFirstChild() to get ahold of the text inside the <option> tag, like so: <option id="teacherName">Mrs. Wormwood</option> How do you access the "Mrs. Wormwood" part? My understanding is that it is a child node of the <option> tag. Calling teacherClone.setNodeValue("foo") didn't do anything. What node should that be setting to "foo" when I call that? Is there a way to make up a new node to add to the <option> tag? It seems that if I have <option id="teacherName"></option> that getFirstChild() returns null. How can I expect to add text there if there isn't an existing node for me to clone? Also I tried to do use the <span> tag, as you mentioned, in my HTML: <option id="teacherName"><span id="teacher">Mrs. Wormwood</span></option> When I run xmlc as xmlc -keep -class org.poindextrose.school.xmlc.AddStudentForm -sourceout ../WEB-INF/classes/ -nocompile -delete-class "DELETE_ME" addStudent.html I see addStudent.html:61: Warning: discarding unexpected <span> addStudent.html:61: Warning: discarding unexpected plain text addStudent.html:61: Warning: discarding unexpected </span> addStudent.html:61: Warning: discarding unexpected </option> and no code gets generated for the 'teacher' span element. Thanks, -M@ On Monday, September 15, 2003, at 01:11 PM, Jacob Kjome wrote:
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Backwards compatability, Jacob Kjome |
|---|---|
| Next by Date: | Re: cloning nodes vs. creating new() ones, Richard Kunze |
| Previous by Thread: | Re: cloning nodes vs. creating new() ones, Jacob Kjome |
| Next by Thread: | Re: cloning nodes vs. creating new() ones, Richard Kunze |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |