net.shibboleth.utilities.java.support.xml
Class DomTypeSupport

java.lang.Object
  extended by net.shibboleth.utilities.java.support.xml.DomTypeSupport

public final class DomTypeSupport
extends Object

Set of helper methods for working with DOM data types.


Field Summary
private static DatatypeFactory dataTypeFactory
          JAXP DatatypeFactory.
 
Constructor Summary
private DomTypeSupport()
          Constructor.
 
Method Summary
static long dateTimeToLong(String dateTime)
          Converts a lexical dateTime, as defined by XML Schema 1.0, into milliseconds since the epoch.
static long durationToLong(String duration)
          Converts a lexical duration, as defined by XML Schema 1.0, into milliseconds.
static DatatypeFactory getDataTypeFactory()
          Gets a static instance of a JAXP DatatypeFactory.
static QName getXSIType(Element e)
          Gets the XSI type for a given element if it has one.
static boolean hasXSIType(Element e)
          Checks if the given element has an xsi:type defined for it.
static String longToDateTime(long dateTime)
          Converts a numerical date/time, given in milliseconds since the epoch, to a lexical dateTime defined by XML Schema 1.0.
static String longToDuration(long duration)
          Converts a duration in milliseconds to a lexical duration, as defined by XML Schema 1.0.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataTypeFactory

private static DatatypeFactory dataTypeFactory
JAXP DatatypeFactory.

Constructor Detail

DomTypeSupport

private DomTypeSupport()
Constructor.

Method Detail

dateTimeToLong

public static long dateTimeToLong(@Nonnull
                                  String dateTime)
Converts a lexical dateTime, as defined by XML Schema 1.0, into milliseconds since the epoch.

Parameters:
dateTime - lexical date/time, may not be null
Returns:
the date/time expressed as milliseconds since the epoch

durationToLong

public static long durationToLong(String duration)
Converts a lexical duration, as defined by XML Schema 1.0, into milliseconds.

Parameters:
duration - lexical duration representation
Returns:
duration in milliseconds

getDataTypeFactory

public static DatatypeFactory getDataTypeFactory()
Gets a static instance of a JAXP DatatypeFactory.

Returns:
the factory or null if the factory could not be created

getXSIType

@Nullable
public static QName getXSIType(@Nullable
                                        Element e)
Gets the XSI type for a given element if it has one.

Parameters:
e - the element
Returns:
the type or null

hasXSIType

public static boolean hasXSIType(@Nullable
                                 Element e)
Checks if the given element has an xsi:type defined for it.

Parameters:
e - the DOM element
Returns:
true if there is a type, false if not

longToDateTime

@Nonnull
public static String longToDateTime(long dateTime)
Converts a numerical date/time, given in milliseconds since the epoch, to a lexical dateTime defined by XML Schema 1.0.

Parameters:
dateTime - the date time to be converted
Returns:
the lexical representation of the date/time

longToDuration

@Nonnull
public static String longToDuration(long duration)
Converts a duration in milliseconds to a lexical duration, as defined by XML Schema 1.0.

Parameters:
duration - the duration
Returns:
the lexical representation


Copyright © 1999-2012. All Rights Reserved.