Package de.stefanreiser
Class XmlEncodingUtil
java.lang.Object
de.stefanreiser.XmlEncodingUtil
public class XmlEncodingUtil
extends java.lang.Object
Methods for converting data between LinkedHashMaps and XML.
- Author:
- Stefan
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XmlEncodingUtil.XmlEncodingException
-
Constructor Summary
Constructors Constructor Description XmlEncodingUtil()
-
Method Summary
Modifier and Type Method Description static java.util.LinkedHashMap
decodeXml(java.lang.String xml)
Decodes an XML-String, returns a LinkedHashMap.static java.lang.String
encodeXml(java.util.LinkedHashMap map)
Converts a LinkedHashMap into its XML representation.static void
main(java.lang.String[] args)
-
Constructor Details
-
XmlEncodingUtil
public XmlEncodingUtil()
-
-
Method Details
-
encodeXml
public static java.lang.String encodeXml(java.util.LinkedHashMap map)Converts a LinkedHashMap into its XML representation.- Parameters:
map
-- Returns:
- XML representation of LinkedHashMap.
-
decodeXml
public static java.util.LinkedHashMap decodeXml(java.lang.String xml) throws XmlEncodingUtil.XmlEncodingException, java.lang.NullPointerExceptionDecodes an XML-String, returns a LinkedHashMap.- Parameters:
xml
- XML representation of a LinkedHashMap.- Returns:
- the data as a LinkedHashMap.
- Throws:
XmlEncodingUtil.XmlEncodingException
- if xml is invalid (does not represent a LinkedHashMap).java.lang.NullPointerException
- if xml == null.
-
main
-