com.highdeal.hci
Class XMLUtils

java.lang.Object
  extended by com.highdeal.hci.XMLUtils

public class XMLUtils
extends java.lang.Object

This Java class provides a collection Java methods for XML utilities.


Constructor Summary
XMLUtils()
           
 
Method Summary
static java.lang.String escapeEntities(java.lang.String s)
          Escapes characters <, >, ', " and &, replacing them by &lt;, &gt;, &apos;, &quot;, and &amp;.
static java.lang.String formatDate(java.util.Date date)
          Formats a date in ISO 8601 date format.
static java.lang.String formatDateTime(java.util.Date date)
          Formats a date and a time in ISO 8601 date time format.
static java.util.Date parseAndValidateDate(java.lang.String date)
          Parses a date in ISO 8601 format (without date coherence verifications) or in milliseconds since January 1, 1970, 00:00:00 GMT.
static java.util.Date parseAndValidateDate(java.lang.String date, boolean onlyISO8601)
          Parses a date in ISO 8601 format (without date coherence verifications) or in milliseconds since January 1, 1970, 00:00:00 GMT.
static java.util.Date parseDate(java.lang.String date)
          Parses a date in ISO 8601 format (without date coherence verifications) or in milliseconds since January 1, 1970, 00:00:00 GMT.
static java.lang.String toString(java.lang.String tagName, IXMLMarshallable model)
           
static java.lang.String toString(XMLMarshallable model)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLUtils

public XMLUtils()
Method Detail

formatDate

public static java.lang.String formatDate(java.util.Date date)
Formats a date in ISO 8601 date format.

Parameters:
date - The date to format
Returns:
The ISO 8601 representation of the date

formatDateTime

public static java.lang.String formatDateTime(java.util.Date date)
Formats a date and a time in ISO 8601 date time format.

Parameters:
date - The date to format
Returns:
The date time in ISO 8601 format or null if the date parameter is null

escapeEntities

public static java.lang.String escapeEntities(java.lang.String s)
Escapes characters <, >, ', " and &, replacing them by &lt;, &gt;, &apos;, &quot;, and &amp;.

Parameters:
s - The string to escape
Returns:
The string with escaped entities

parseDate

public static java.util.Date parseDate(java.lang.String date)
Parses a date in ISO 8601 format (without date coherence verifications) or in milliseconds since January 1, 1970, 00:00:00 GMT.

Parameters:
date - The string to parse
Returns:
The date

parseAndValidateDate

public static java.util.Date parseAndValidateDate(java.lang.String date,
                                                  boolean onlyISO8601)
                                           throws java.lang.IllegalArgumentException,
                                                  java.lang.NullPointerException,
                                                  java.lang.RuntimeException
Parses a date in ISO 8601 format (without date coherence verifications) or in milliseconds since January 1, 1970, 00:00:00 GMT.

Parameters:
date - The string to parse
onlyISO8601 - true if the parsing must accept only the ISO 8601 format
Returns:
The date
Throws:
java.lang.IllegalArgumentException - when the argument does not validate the ISO 8601
java.lang.NullPointerException - when the argument is null
java.lang.RuntimeException - can be thrown by the Java API

parseAndValidateDate

public static java.util.Date parseAndValidateDate(java.lang.String date)
                                           throws java.lang.IllegalArgumentException,
                                                  java.lang.NullPointerException,
                                                  java.lang.RuntimeException
Parses a date in ISO 8601 format (without date coherence verifications) or in milliseconds since January 1, 1970, 00:00:00 GMT.

Parameters:
date - The string to parse
Returns:
The date
Throws:
java.lang.IllegalArgumentException - when the argument does not validate the ISO 8601
java.lang.NullPointerException - when the argument is null
java.lang.RuntimeException - can be thrown by the Java API

toString

public static final java.lang.String toString(java.lang.String tagName,
                                              IXMLMarshallable model)

toString

public static final java.lang.String toString(XMLMarshallable model)

Document Published: October 2015 (SAP CC 4.0 SP10 and Later)