| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
content
The content of a simple node.
|
java.lang.String |
name
The element name.
|
protected java.lang.Object |
userObject
The user object to tag along.
|
static java.lang.String |
XSD
The XSD namespace.
|
static java.lang.String |
XSI
The XSD instance URI.
|
| Constructor and Description |
|---|
XElementBase(java.lang.String name)
Constructor, sets the element name.
|
| Modifier and Type | Method and Description |
|---|---|
abstract java.lang.String |
childValue(java.lang.String name)
Returns the content of the first child which has the given name.
|
abstract XElementBase |
copy() |
double |
doubleValue(java.lang.String name)
Returns a double value of the supplied child or throws an exception if missing.
|
double |
doubleValue(java.lang.String name,
double defaultValue)
Returns a double value or the default value if the element is missing or empty.
|
static java.lang.String |
formatDateTime(java.util.Date date)
Convert the given date to string.
|
static java.lang.String |
formatDateTime(java.time.temporal.TemporalAccessor temporal)
Convert the given date to string.
|
int |
intValue(java.lang.String name)
Returns an integer value of the supplied child or throws an exception if missing.
|
int |
intValue(java.lang.String name,
int defaultValue)
Returns an integer value or the default value if the element is missing or empty.
|
long |
longValue(java.lang.String name)
Returns a long value of the supplied child or throws an exception if missing.
|
long |
longValue(java.lang.String name,
long defaultValue)
Returns a long value or the default value if the element is missing or empty.
|
static java.time.OffsetDateTime |
parseDateTime(java.lang.String date)
Parse an XSD dateTime.
|
static java.lang.String |
sanitize(java.lang.String s)
Converts all sensitive characters to its HTML entity equivalent.
|
void |
setValue(java.lang.Object value)
Sets or clears the content of this element.
|
public static final java.lang.String XSD
public static final java.lang.String XSI
public java.lang.String content
public final java.lang.String name
protected java.lang.Object userObject
public XElementBase(java.lang.String name)
name - the element namepublic static java.lang.String formatDateTime(java.util.Date date)
date - the date, not nullpublic static java.lang.String formatDateTime(java.time.temporal.TemporalAccessor temporal)
temporal - temporal accessiblepublic static java.time.OffsetDateTime parseDateTime(java.lang.String date)
throws java.text.ParseException
date - the date stringjava.text.ParseException - format exceptionpublic static java.lang.String sanitize(java.lang.String s)
s - the string to convert, can be nullpublic int intValue(java.lang.String name)
name - the child element namepublic int intValue(java.lang.String name,
int defaultValue)
name - the element namedefaultValue - the default valuepublic long longValue(java.lang.String name)
name - the child element namepublic long longValue(java.lang.String name,
long defaultValue)
name - the element namedefaultValue - the default valuepublic double doubleValue(java.lang.String name)
name - the child element namepublic double doubleValue(java.lang.String name,
double defaultValue)
name - the element namedefaultValue - the default valuepublic abstract java.lang.String childValue(java.lang.String name)
name - the child namepublic final void setValue(java.lang.Object value)
value - the value set or null to clearpublic abstract XElementBase copy()