Thank you, I noticed what my mistake was about 2 seconds before receiving your email.
The node type is "text", not "element". Thanks again. Matt -----Original Message----- From: Keith Visco [mailto:[EMAIL PROTECTED]] Sent: Friday, September 20, 2002 5:37 PM To: [EMAIL PROTECTED] Subject: Re: [castor-dev] Problem with Attribute and Text in same tag Matthew, You should change your mapping file to something like the following: <class name="File"> <map-to xml="file"/> <field name="Text" type="java.lang.String"> <bind-xml node="text"/> </field> <field name="Type" type="java.lang.String"> <bind-xml name="type" node="attribute"/> </field> </class> --Keith "Siegel, Matthew" wrote: > > Hi all, > > I am using Castor version 0.9.3.21. I am having a problem unmarshalling a > very very simple xml file. > > Here's the xml file: > > <file type="gif"> > image_file.gif > </file> > > Here's my mapping file: > > <class name="File"> > <field name="Text" type="java.lang.String"> > <bind-xml name="file" node="element"/> > </field> > > <field name="Type" type="java.lang.String"> > <bind-xml name="type" node="attribute"/> > </field> > </class> > > Here's the exception that I am getting: > > org.xml.sax.SAXException: Illegal Text data found as child of: file > value: " > image_file.gif > " > at org.exolab.castor.xml.UnmarshalHandler.endElement(Unknown Source) > at > org.apache.xerces.parsers.SAXParser.endElement(SAXParser.java:1392) > at > org.apache.xerces.validators.common.XMLValidator.callEndElement(XMLValidator > .java:1550) > at > org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.dispatch(XM > LDocumentScanner.java:1149) > at > org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentScanner. > java:381) > at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1098) > at org.exolab.castor.xml.Unmarshaller.unmarshal(Unknown Source) > > I would think that I would be allowed to put an attribute and body in the > same tag. > > Any help would be appreciated! > > Thanks, > > Matt Siegel > Software Engineer > Solers, Inc. > http://www.solers.com > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-dev ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev ----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to [EMAIL PROTECTED] with a subject of: unsubscribe castor-dev
