OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] HashMap in an XML document

[ Lists Home | Date Index | Thread Index ]

From: <arajvanshi@hss.hns.com>

>    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.

Cheers
Rick Jelliffe




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS