[jdom-interest] Element.addContent won't accept String in Collection

Syloke Soong ssoong at protedyne.com
Tue Nov 7 11:27:01 PST 2006


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



More information about the jdom-interest mailing list