because the XML parser will expand entity references when it parses the document, if it sees & it can expand it to &, but if it sees a standalone &, it doesn't know what to do with it, or if it happens to be next to another character, it iwll try to interpret that as an entity reference. There are five built-in entity references, and you can define your own as well, but custom ones you can define the values for in your DTD.
One technique is to enclose markup you don't want parse to allow these characters in a CDATA section, so perhaps: <root> <element><![CDATA[ &<myest]]></element> </root> This tells the XML parser to not parse what is contained in between [ and ]. This technique is often used in applications where javascript is used, to avoid parsing errors with Javascript operators like &. Or you can just use the character entity. HTH, Mike Jasnowski -----Original Message----- From: Andy Schmidgall [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 12:44 PM To: Struts Users Mailing List Subject: RE: Digester does not like '&' Well, I know & is the character entity for &, but I'm just not clear on why & works in this case... Is it simply because '&' is flagged in the parser as reserved for entities of the form "&xxx;", or is there another reason? That's all I was asking. Sorry if I wasn't clear :) -Andy -----Original Message----- From: Christian Bollmeyer [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 11, 2002 11:35 AM To: Struts Users Mailing List Subject: Re: Digester does not like '&' & is the character entity for the ampersand sign '&'. -- Chris NB. This is so basic that you absolutely should look this up when seriously doing web development. ----- Original Message ----- From: "Andy Schmidgall" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, December 11, 2003 6:23 PM Subject: OT: Digester does not like '&' I'm sure I'm demonstrating a lack of basic knowledge about character encoding here, but why does "&" work when '&' doesn't? The thing that gets me is that they both have '&' in them :) -Andy -----Original Message----- From: Robert Taylor [mailto:[EMAIL PROTECTED] Sent: Thursday, December 11, 2003 10:54 AM To: Struts Users Mailing List Subject: RE: Digester does not like '&' Try & > -----Original Message----- > From: Chiming Huang [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 11, 2003 11:51 AM > To: Struts Users Mailing List > Subject: Digester does not like '&' > > > Hi, > > We are using the Digester which comes with the Struts 1.1 for reading > xml files. The Digester will throw exception if the data contains an > '&' character. Is there a way to work around this? > > Thanks, > Chiming > > > --------------------------------- > Do you Yahoo!? > Free Pop-Up Blocker - Get it now --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]