  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | Element.addContent won 't accept String in Collection | Element.addContent won 't accept String in Collection 2006-11-16 - By Jason Hunter
Back I just added this.
-jh-
Jason Hunter wrote: > You're right, a String should be suitable to add there. If you'd like > to add it, I think the way to do so is to check if it's a String and if > so wrap it with a Text instance before proceeding. That lets the class > continue to hold a Content[]. I'll add it. > > -jh- > > Syloke Soong wrote: >> JDOM javadoc says, >> >> [javadoc] >> Element addContent(java.util.Collection collection) Appends all >> children in the given collection to the end of the content >> list. >> >> Element addContent(int index, java.util.Collection c) Inserts the >> content in a collection into the content list at the given >> index. >> >> Element addContent(java.lang.String str) This adds text content to >> this element. >> [/javadoc] >> >> Since you could add individual String, I presumed no harm would come my >> way if String objects are included in the collection argument. >> >> But no, I had a Vector with a String object and addContent(collection) >> rejected the vector due to ... >> >> org.jdom.IllegalAddException: Class java.lang.String is of unrecognized >> type and cannot be added >> org.jdom.ContentList.add(ContentList.java:142) >> org.jdom.ContentList.addAll(ContentList.java:292) >> org.jdom.ContentList.clearAndSet(ContentList.java:338) >> org.jdom.Element.setContent(Element.java:742) >> >> >> Hrrrmmmmpppphhhhhhhh .... ! >> >> This email and any files transmitted with it are confidential and >> intended solely for the use of the individual or entity to whom they >> are addressed. If you have received this email in error please notify >> the sender immediately. Please note that any views or opinions >> presented in this email are solely those of the author and do not >> necessarily represent those of the company. Even though this company >> takes every precaution to ensure this email is virus-free, the >> recipient should check this email and any attachments for the presence >> of viruses. The company accepts no liability for any damage caused by >> any virus transmitted by this email. >> Protedyne Corporation, 1000 Day Hill Rd, Windsor, CT 06095, >> USA, >> www.protedyne.com >> >> __ ____ ____ ____ ____ ____ ____ ____ ____ ____ >> To control your jdom-interest membership: >> http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected) >> > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ > To control your jdom-interest membership: > http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected) > __ ____ ____ ____ ____ ____ ____ ____ ____ ____ To control your jdom-interest membership: http://www.jdom.org/mailman/options/jdom-interest/youraddr@(protected)
|
|
 |