[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: HashMap in an XML document


java serialize hashmap
From: <arajvanshi@h...>

>    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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.