Re: XML coding questions

From: wojingo (wojing..astmail.com.au)
Date: Sun Dec 05 2004 - 06:54:33 EST

  • Next message: Kevin J. Menard, Jr.: "Re: XML coding questions"

    Hi,

    I thought it looked like the following,

    final XMLDecoder decoder = XMLDecoder.decoder();
    Test t = (Test)decoder.decodeRootObject("input.xml");

    Or have I misunderstood what you meant?

    On Sat, 2004-12-04 at 13:05, Kevin J. Menard, Jr. wrote:
    > Ok, I have another one. I'll just keep everything in this thread.
    > This one should be easy, but for the life of me, I can't figure it out.
    >
    > The XMLDecoder docs say that an XML file can be decoded to an object if
    > its class has a single arg constructor that takes an XMLDecoder as its
    > only argument. So, is decodeRootObject() used with the output just
    > tossed away? So the execution flow would be something like:
    >
    > final XMLDecoder decoder = XMLDecoder.decoder();
    > decoder.decodeRootObject("output.xml");
    > final Test t = new Test(decoder);
    >
    > I guess the issue is letting the decoder know what it should actually
    > be decoding. This seems like what should be done to me, but I just
    > want to verify before I really commit to it ;-)
    >
    > Additionally, how did WebObjects differentiate between classes with the
    > 1 constructor arg and those that could be decoded innately? I could
    > use reflection to detect the former case, and I'm simulating the latter
    > with java.beans.XML{En|De}coder, but that would seem to me that I would
    > have to modify the decoder API to have some method that takes in a
    > java.lang.Class. Otherwise, I can't really tell how WebObjects
    > differentiated between the two cases.
    >
    > --
    > Thanks,
    > Kevin
    >

    -- 
    shaun
    



    This archive was generated by hypermail 2.0.0 : Sun Dec 05 2004 - 05:50:01 EST