.addAttribute() does, setText() doesn't.  No idea why.  Here's my code 
fragment that's working correctly.  It wasn't producing valid XML until 
I added the encodeXML() function.

            option.addAttribute("value", value);

            if( value.equals(selected) ){
                option.addAttribute("selected", "selected");
            }

            if(one || (first != null && last == null) ) option.setText( 
encodeXML(value) );
            else{
                if(last != null) option.setText( encodeXML( 
DOMTools.trim(rs.getString(last)) ) );
                else option.setText( encodeXML( 
DOMTools.trim(rs.getString(2)) ) );
            }

        }
        return select;
    }
   
    public static String encodeXML(String input){
        StringBuffer sb = new StringBuffer(input);       
        DOMTools.replace(sb, "&", "&", false);
        DOMTools.replace(sb, "<", "&lt;", false);
        DOMTools.replace(sb, ">", "&gt;", false);       
        return sb.toString();
    }

Edwin Dankert wrote:
> Isn't hat exactly what it does at the moment?
>
> Regards,
> Edwin



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to