public class XMLUtils
extends java.lang.Object
Java class provides a collection Java methods for XML utilities.| Constructor and Description |
|---|
XMLUtils() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
escapeEntities(java.lang.String s)
Escapes characters <, >, ', " and &,
replacing them by <, >, ', ",
and &.
|
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)
Returns the XML representation of the specified model as a string with the specified root element name.
|
static java.lang.String |
toString(XMLMarshallable model)
Returns the XML representation of the specified model as a string.
|
static java.lang.String |
toString(XMLMarshallable model,
int indentLevel)
Returns the XML representation of the specified model as a string with the specified indentation level.
|
static XMLNode |
toXMLNode(XMLMarshallable model) |
public static java.lang.String formatDate(java.util.Date date)
date - The date to formatpublic static java.lang.String formatDateTime(java.util.Date date)
date - The date to formatpublic static java.lang.String escapeEntities(java.lang.String s)
s - The string to escapepublic static java.util.Date parseDate(java.lang.String date)
date - The string to parsepublic static java.util.Date parseAndValidateDate(java.lang.String date,
boolean onlyISO8601)
throws java.lang.IllegalArgumentException,
java.lang.NullPointerException,
java.lang.RuntimeException
date - The string to parseonlyISO8601 - true if the parsing must accept only the ISO 8601 formatjava.lang.IllegalArgumentException - when the argument does not validate the ISO 8601java.lang.NullPointerException - when the argument is nulljava.lang.RuntimeException - can be thrown by the Java APIpublic static java.util.Date parseAndValidateDate(java.lang.String date)
throws java.lang.IllegalArgumentException,
java.lang.NullPointerException,
java.lang.RuntimeException
date - The string to parsejava.lang.IllegalArgumentException - when the argument does not validate the ISO 8601java.lang.NullPointerException - when the argument is nulljava.lang.RuntimeException - can be thrown by the Java APIpublic static final java.lang.String toString(java.lang.String tagName,
IXMLMarshallable model)
tagName - the name of the root elementmodel - the model to marshalpublic static final java.lang.String toString(XMLMarshallable model)
model - the model to marshalpublic static final java.lang.String toString(XMLMarshallable model, int indentLevel)
model - the model to marshalindentLevel - the indentation levelpublic static final XMLNode toXMLNode(XMLMarshallable model)