[jdom-interest] How to replace an Element with Text?
bcox at virtualschool.edu
Sat Mar 27 14:35:13 PST 2004
I've an XHTML processing application that supports persistent forms.
It needs to rewrite some elements (<input type="radio"> and <option>
elements, for example) as text elements (velocity macro calls that
add checked="checked" attributes).
<input type="radio" ... > must be rewritten as #radioElement(...)
<option>Value</option> must be rewritten as #optionElement(...)
with suitable attributes and arguments of course.
First try (iteration over the List returned by XPath) didn't work
because you can only delete elements, not replace them.
Second try was index through list and use set(index, new Text(...))
to replace elements. That approach didn't work either. Debugger
showed that the list was modified propertly, but the changes didn't
affect the underlying DOM, just the list.
Can someone explain why #2 didn't work and what I can do to fix it? Thanks!
Brad J. Cox, PhD, 703 361 4751, http://virtualschool.edu
http://virtualschool/ale Action Learning Environment
http://virtualschool.edu/mybank Digital Rights Management System
http://virtualschool.edu/jco Java Cryptographic Objects (JCO)
http://virtualschool.edu/jwaa Java Web Application Architecture (JWAA)
http://virtualschool.edu/java+ Java Preprocessor (Java+)
More information about the jdom-interest