com.funambol.syncclient.common
Class XMLHashMapParser

java.lang.Object
  extended by com.funambol.syncclient.common.XMLHashMapParser

public class XMLHashMapParser
extends java.lang.Object

It supplies the methods for the marshall and unmarshall of a HashMap in xml.

The xml begins with <RECORD> and ends with </RECORD>

Every object of the table comes represented with formed following

<FIELD>
  <NAME>name of the field</NAME>
  <VALUE>value of the field</VALUE>
</FIELD>

Example of HashMap represented in xml:

<RECORD>
  <FIELD>
    <NAME>name</NAME>
    <VALUE>john</VALUE>
  </FIELD>
  <FIELD>
    <NAME>birthDate</NAME>
    <VALUE>100128313321</VALUE>
  </FIELD>
</RECORD>

The null values are represent by NULL_VALUE

Version:
$Id: XMLHashMapParser.java,v 1.3 2007-12-22 18:09:17 nichele Exp $

Constructor Summary
XMLHashMapParser()
           
 
Method Summary
static java.util.Map toMap(java.lang.String xml)
          Converts a xml in HashMap
static java.lang.String toXML(java.util.Map values)
          Converts a HashMap in xml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLHashMapParser

public XMLHashMapParser()
Method Detail

toXML

public static java.lang.String toXML(java.util.Map values)
Converts a HashMap in xml

Parameters:
values - the HasMap to convert
Returns:
the representation of the given HasMap in xml

toMap

public static java.util.Map toMap(java.lang.String xml)
                           throws java.lang.IllegalStateException
Converts a xml in HashMap

Parameters:
xml - the xml to convert
Returns:
the HashMap correspondent to the given xml
Throws:
java.lang.IllegalStateException - if an error occurs during the conversion


Copyright © 2010 Funambol. All Rights Reserved.