I didn't check the xml. Because currently we are thinking of using castor's
Marshaller and Unmarshaller.
I know for a fact the "java side" (my server) is not changing the '&' to '
&', because I wrote the code. In an earlier version
i made these changes for special characters but on this prototype using
castor I haven't implemented it yet.
I checked the xml and it puts in the &

the Marshaller.marshal must be doing it.


code:
cs.setLastName("HORAN & CO.");
 Marshaller.marshal(cs,csw);
  System.out.println(csw.toString());

output from println:

 <last-name>HORAN &amp; CO.</last-name>




                                                                                       
                            
                    Keith Visco                                                        
                            
                    <kvisco@intal        To:     [EMAIL PROTECTED]                 
                            
                    io.com>              cc:     (bcc: Richard E. Horan/Telcordia)     
                            
                                         Subject:     Re: [castor-dev] Unmarshalling   
                            
                    01/09/2002                                                         
                            
                    02:45 PM                                                           
                            
                    Please                                                             
                            
                    respond to                                                         
                            
                    castor-dev                                                         
                            
                                                                                       
                            
                                                                                       
                            






On the Java side, it should be '&', on the XML side it should be '&amp;'

Because you marshalled first and then unmarshalled, you probably
modified the value inside your java application and then marshalled to
XML. Did you check the XML result to see what it looked like?

When you unmarshal '&amp;' will get converted back into '&'.

--Keith


"Richard E. Horan" wrote:
>
> what am I doing wrong?
>
> I wanted to test this on my stuff to see what would happen.
> So I merely added '&' inside a string, nothing else and it worked with no
> exceptions.
> the string was 'Rick Horan' I modified it to 'Rick & Horan'. I marshalled
> and then unmarshalled and the field was set
> to 'Rick & Horan'. Why did it work? Any thoughts?
>
>
>                     Keith Visco
>                     <kvisco@intal        To:     [EMAIL PROTECTED]
>                     io.com>              cc:     (bcc: Richard E.
Horan/Telcordia)
>                                          Subject:     Re: [castor-dev]
Unmarshalling
>                     01/09/2002
>                     01:55 PM
>                     Please
>                     respond to
>                     castor-dev
>
>
>
> "VOIRY,ANTOINE (HP-France,ex2)" wrote:
> >
> > Hi,
> > This syntax does not work neither.
> > Antoine
>
> Works fine for me. Mats answer to your question is correct. You need to
> use &amp; instead of just &.
>
> These are the basic syntax rules of XML 1.0, and have nothing to do with
> Castor.
>
> --Keith
>
> > -----Original Message-----
> > From: mats nyberg [mailto:[EMAIL PROTECTED]]
> > Sent: mercredi 9 janvier 2002 11:46
> > To: [EMAIL PROTECTED]
> > Subject: Re: [castor-dev] Unmarshalling
> >
> > for starters and not very castor oriented; that is not valid XML!
> >
> > should be 'C&amp;A' instead, as i'm sure someone will tell you soon
> >
> > //mats
> >
> > VOIRY,ANTOINE (HP-France,ex2) wrote:
> >
> > >Hi all,
> > >I have only one easy question. How do we unmarshall a message that
> contains
> > >field with special chararcter like &, without having an exception.
> > >Example :
> > ><MyExample>
> > >       <Company>C&A</Compagny>
> > ></MyExample>
> > >
> > >If I try to unmarshall this, I receive :
> > >       org.xml.sax.SAXException: Parsing Error : The entity name must
> > >immediately follow the '&' in the entity reference.
> > >
> > >Thanks in advance
> > >Antoine
> > >
> > >-----------------------------------------------------------
> > >If you wish to unsubscribe from this mailing, send mail to
> > >[EMAIL PROTECTED] with a subject of:
> > >       unsubscribe castor-dev
> > >
> > >
> > >
> >
> > --
> > Mats Nyberg
> > ----------------------------------------------------
> >
> > Teknik i Media Sverige AB (publ)
> > Address: S�dra F�rstadsgatan 2, SE-211 43 Malm�, Sweden
> > Direkt: +46 40 601 57 10
> > Mobile: +46 70 420 57 10
> > V�xel: +46 40 601 57 00
> > http://www.tim.se
> >
> > DISCLAIMER: "The information contained in this email and any attachment
> is
> > confidential. It is intended only for the named addressee(s). If you
are
> not
> > the named addressee please notify the sender immediately and do not
> > disclose, copy or distribute the contents to any other person other
than
> the
> > intended addressee(s)."
> >
> > -----------------------------------------------------------
> > 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
>
> -----------------------------------------------------------
> 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

Reply via email to