Jaspreet Singh writes:
 > Hi all
 >      I am facing a problem.. i have to unmarshal an xml and the format is
 > like..
 > 
 > <a>
 >      <b>
 >              <c></c>
 >              <d></d>
 >      <b>
 > <a>
 > 
 > now i have made classes for a, c and d but not for b i.e i want to ignore
 > the <b> tag. but the castor library ignores the b tag and the file is not
 > unmarshalled at all i.e an object corresponding to the tag a is created but
 > it does not contain anything. now my question is that what should be the
 > mapping file like? should there be a tag for b also? what should it contain
 > (type, get-method, set-method, collection)?
 > also, if i am able to unmarshal it properly(hopefully), then will this
 > mapping file suffice for marshalling also or will i have to make a separate
 > file?

Hi,

>From what I understand of your problem, you will need to have a class
for 'b'. Castor does not support tag that relate to no classes.

After that, you could make accessor function in 'a' like this:

class A {

      private B _b;

      ....

      public C getC() {
             return _b.getC();
      }
      ....
}


Another solution would be to go trough a XSLT processor before
handling the XML to Castor in order to remove the '<b>'.

Seb

-- 
There is a theory which states that if ever anyone discovers exactly
what the Universe is for and why it is here, it will instantly
disappear and be replaced by something even more bizarre and
inexplicable. There is another theory which states that this has
already happened.
       -- Douglas Adams, The Restaurant at the End of the Universe

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to