com.funambol.syncclient.common
Class SourceUtils

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

public class SourceUtils
extends java.lang.Object

Provide methods to convert XML to HashMap and HashMap to XML


Field Summary
static java.lang.String ROOT_NAME
           
static java.lang.String TAG_XML_VERSION
           
 
Constructor Summary
SourceUtils()
           
 
Method Summary
static java.lang.String handleLineDelimiting(java.lang.String content)
          This method is used to replace the String "=\r\n" with the String "\r\n ": This replace is necessary because the are devices that doesn't sent the correct line delimiting for long line.
static java.lang.String hashMapToXml(java.util.HashMap fields)
          Make xml from an HashMap.
static java.util.HashMap xmlToHashMap(java.io.InputStream is)
          Make a HashMap of fieldName - fieldValue tagName -> key tagValue -> value
static java.util.HashMap xmlToHashMap(java.lang.String content)
          Make a HashMap of fieldName - fieldValue tagName -> key tagValue -> value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT_NAME

public static final java.lang.String ROOT_NAME
See Also:
Constant Field Values

TAG_XML_VERSION

public static final java.lang.String TAG_XML_VERSION
Constructor Detail

SourceUtils

public SourceUtils()
Method Detail

xmlToHashMap

public static java.util.HashMap xmlToHashMap(java.lang.String content)
                                      throws java.lang.Exception
Make a HashMap of fieldName - fieldValue tagName -> key tagValue -> value

Parameters:
content -
Returns:
HashMap of fieldName - fieldValue
Throws:
java.lang.Exception

xmlToHashMap

public static java.util.HashMap xmlToHashMap(java.io.InputStream is)
                                      throws java.lang.Exception
Make a HashMap of fieldName - fieldValue tagName -> key tagValue -> value

Parameters:
is -
Returns:
HashMap of fieldName - fieldValue
Throws:
java.lang.Exception

hashMapToXml

public static java.lang.String hashMapToXml(java.util.HashMap fields)
                                     throws java.lang.Exception
Make xml from an HashMap. key -> tagName value -> tagValue

Parameters:
fields -
Returns:
String with the xml
Throws:
java.lang.Exception

handleLineDelimiting

public static java.lang.String handleLineDelimiting(java.lang.String content)
This method is used to replace the String "=\r\n" with the String "\r\n ": This replace is necessary because the are devices that doesn't sent the correct line delimiting for long line.

Parameters:
content - the input content
Returns:
the input content with property handling long line


Copyright © 2010 Funambol. All Rights Reserved.