value: "*"
java.lang.Throwable(java.lang.String)
java.lang.Exception(java.lang.String)
org.xml.sax.SAXException(java.lang.String)
void org.exolab.castor.xml.UnmarshalHandler.endElement(java.lang.String)
void org.apache.xerces.parsers.SAXParser.endElement(org.apache.xerces.utils.QName)
void org.apache.xerces.validators.common.XMLValidator.callEndElement(int)
boolean org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(boolean)
boolean org.apache.xerces.framework.XMLDocumentScanner.parseSome(boolean)
void org.apache.xerces.framework.XMLParser.parse(org.xml.sax.InputSource)
java.lang.Object org.exolab.castor.xml.Unmarshaller.unmarshal(org.xml.sax.InputSource)
java.lang.Object org.exolab.castor.xml.Unmarshaller.unmarshal(java.io.Reader)
java.lang.Object org.exolab.castor.xml.Unmarshaller.unmarshal(java.lang.Class, java.io.Reader)
edu.insead.calt.inca.base.InCAObject edu.insead.calt.inca.base.InCAObject.xml_Xml2Object(java.lang.String, java.lang.String, java.lang.Class)
edu.insead.calt.inca.base.InCAObject edu.insead.calt.inca.base.InCAObject.loadObjectFromXmlWithMapping(java.lang.String, java.lang.Class)
edu.insead.calt.inca.base.InCAObject edu.insead.calt.inca.base.InCAObject.loadObject(java.lang.String, java.lang.String)
edu.insead.calt.inca.ontology.behaviour.Behaviour edu.insead.calt.inca.ontology.behaviour.group.BehaviourGroup.loadBehaviour(java.lang.String)
void edu.insead.calt.inca.InCAweb.initializeAll()
void edu.insead.calt.inca.InCAServlet.init()
void javax.servlet.GenericServlet.init(javax.servlet.ServletConfig)
void org.apache.tomcat.core.ServletWrapper.doInit()
void org.apache.tomcat.core.Handler.init()
void org.apache.tomcat.core.ServletWrapper.init()
void org.apache.tomcat.core.Handler.service(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response)
void org.apache.tomcat.core.ServletWrapper.service(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response)
void org.apache.tomcat.core.ContextManager.internalService(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response)
void org.apache.tomcat.core.ContextManager.service(org.apache.tomcat.core.Request, org.apache.tomcat.core.Response)
void org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(org.apache.tomcat.service.TcpConnection, java.lang.Object [])
void org.apache.tomcat.service.TcpWorkerThread.runIt(java.lang.Object [])
void org.apache.tomcat.util.ThreadPool$ControlRunnable.run()
void java.lang.Thread.run()
---------
...
//-- check for character content
if
((state.buffer != null) &&
(state.buffer.length() > 0)
&&
(state.classDesc != null)) {
XMLFieldDescriptor cdesc =
state.classDesc.getContentDescriptor();
if (cdesc != null)
{
....
} else {
//-- check for non-whitespace...and
report error
if (!isWhitespace(state.buffer)) {
String err = "Illegal Text data found
as child of: "
+ name;
err += "\n value: \"" +
state.buffer + "\"";
throw new SAXException(err);
==> exception generated!!!!
==> buffer = "*" name =
"contexts"
}
}
...
}
Thierry Nabeth
Research Fellow,
INSEAD CALT (The Centre
for Advanced Learning Technologies)
http://www.insead.edu/~nabeth/
http://www.insead.edu/CALT/
[EMAIL PROTECTED]
tel:
+33 1 60 72 43 12
fax: +33 1 60 74 55 50
-----Original Message-----
From: Romilson Cruz de Carvalho [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 11, 2002 5:19 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Error while unmarshalling a collection of StringsWell Thierry,If you see in CastorXML Mapping Document, there are the table:If there is a collection attribute, you can use the following table:
name <type> default implementation array <type_attribute>[] <type_attribute>[] vector java.util.Vector java.util.Vector hashtable java.util.Hashtable java.util.Hashtable collection java.util.Collection java.util.Arraylist set java.util.Set java.util.Hashset map java.util.Map java.util.Hashmap Right, we case is the first line.The Castor will mount the set/get methods assignature as :public void <set-method>(<type> value);----------------------- your mapping will stay as...
<class name="filter" >
<field name="contexts" collection="array" type="java.lang.String" />
</class>Castor will mount the set/get methods as follow:public void setContexts( java.lang.String[] <value> )public String[] getContexts()I think the correct way your mapping file is like above.Your class must be:public class Filter {
//...some fields
String[] contexts;Filter () {...}public void setContexts(String[] aContext) {..//code..}public String[] getContexts() {...//code..}// no add ... methods}Your XML file must be like ..<? xml.... ?><filter><contexts>BLABLABLABLA1</contexts><contexts>BLABLABLABLA2</contexts><contexts>BLABLABLABLA3</contexts></filter>Remember that if you not put the "public" .. yours methods will are private ..and Castor will not find they.If yet has errors, please write the error description and send other mail to list.Romilson C. CarvalhoWell , i think the solution as:----------------------- XML doc<? xml version="1.0" ?><filter><context>Context One</context><context>Context Two</context></filter>----------------------- Bean associated-----Mensagem original-----
De: NABETH Thierry [mailto:[EMAIL PROTECTED]]
Enviada em: quinta-feira, 11 de abril de 2002 10:57
Para: [EMAIL PROTECTED]
Assunto: Re: [castor-dev] Error while unmarshalling a collection of StringsHello,>> can you write your mapping file ?My mapping file was something like:----------------------- mapping
<class name="filter" >
<field name="contexts" collection="array" type="string" />
</class>
----------------------- marshall fileBut I tried several combinations such as:<field name="contexts" collection="array" type="string" />
<field name="contexts" /><field name="contexts" type="strings" />etc.with the same result.public Class Filter {
...some fields
String[] contexts;Filter () {...}setContexts(String[] aContext) {...}String[] getContexts() {...}// no add ... methods}I even tried to transform the array of string into a Vector containing strings()(of course both in the source code and in the mapping file)Note:I have been using successfully Vector to marshall/unmarshall compexobjects.My java development Environment is IBM Visual Age for Java.Thierry-----Original Message-----
From: Romilson Cruz de Carvalho [mailto:[EMAIL PROTECTED]]
Sent: Thursday, April 11, 2002 2:30 PM
To: [EMAIL PROTECTED]
Subject: Re: [castor-dev] Error while unmarshalling a collection of StringsHi ,I has saw your question now .. can you write your mapping file ? and the JavaBean associated that contains the collection of strings ?Thanks , and wait.
Romilson-----Mensagem original-----
De: NABETH Thierry [mailto:[EMAIL PROTECTED]]
Enviada em: quinta-feira, 11 de abril de 2002 5:08
Para: [EMAIL PROTECTED]
Assunto: [castor-dev] Error while unmarshalling a collection of Strings...
