Lists Home |
Date Index |
> The problem is that some APIs have complex arguments like Vector, HashMap
> which needs to be passed using XML. If I have to extract each and every element
> of HashMap to form a new element in the XML doc, it will be a big overhead. I
> wanted to ask whether we can directly pass an Object (like HashMap, Vector) in
> an XML document by some means.
You can serialize your objects to XML if you add an XML serialization method
to all of them.
Probably a more practical approach is to serialize just the big, self-contained problem
objects (to Java's serialed format, then encode in Bin64), and send that data
in XML elements which represent the rest of your data and its envelope. Then you only
need to write the XML serialization methods for your higher-level and custom objects.
So that way you get the advantages of XML (can route it through different platforms
and use generic tools to process it) but not give yourself a lot of work for
trying to serialize things that only the receiving Java program at the other end
is interested in.
Remember that a lot XML discussion assumes loose coupling; you don't
know what language or OS or API is at the remote end. Your case is
different, from what I gather, because your end-points are Java.
Apparantly serialized Java can take more space than XML (if there are a lot
of 32 bit references) too.