How to replace an Element with Text? 2004-03-27 - By Brad Cox
Back 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).
For example <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+) __ ____ ____ ____ ____ ____ ____ ____ ____ ____ To control your jdom-interest membership: http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@(protected) .com
|
|