Methods to create XML simple values

The following table lists static methods on the XmlSimpleValue type that create XmlSimpleValue instances of various types.

Method signature

Description

makeAnyURIInstance(java.net.URI)

Creates a URI instance

makeBase64BinaryInstance(byte[])

Creates a base 64 binary instance from byte array

makeBase64BinaryInstance(gw.xml.BinaryDataProvider)

Creates a base 64 binary instance from binary data provider

makeBooleanInstance(java.lang.Boolean)

Creates a Boolean instance

makeByteInstance(java.lang.Byte)

Creates a byte instance

makeDateInstance(gw.xml.date.XmlDate)

Creates a date-time instance from an XmlDate

makeDateTimeInstance(gw.xml.date.XmlDateTime)

Creates a date instance from an XmlDateTime

makeDecimalInstance(java.math.BigDecimal)

Creates a decimal instance from a BigDecimal

makeDoubleInstance(java.lang.Double)

Creates a decimal instance from a Double

makeDurationInstance(gw.xml.date.XmlDuration)

Creates a duration instance

makeFloatInstance(java.lang.Float)

Creates a float instance

makeGDayInstance(gw.xml.date.XmlDay)

Creates a GDay instance (the numerical day of the month)

makeGMonthDayInstance(gw.xml.date.XmlMonthDay)

Creates a GMonthDay duration instance (the numerical month and day)

makeGMonthInstance(gw.xml.date.XmlMonth)

Creates a GMonth instance (the numerical month)

makeGYearInstance(gw.xml.date.XmlYear)

Creates a GYear instance (the numerical year)

makeGYearMonthInstance(gw.xml.date.XmlYearMonth)

Creates a GYearMonth instance (the numerical year and month)

makeHexBinaryInstance(byte[])

Creates a hex binary instance from byte array

makeIDInstance(java.lang.String)

Creates an IDInstance instance from a String

makeIDREFInstance(gw.xml.XmlElement)

Creates an IDREF instance

makeIntegerInstance(java.math.BigInteger)

Creates a big integer instance

makeIntInstance(java.lang.Integer)

Creates an integer instance

makeLongInstance(java.lang.Long)

Creates a long integer instance

makeQNameInstance(javax.xml.namespace.QName)

Creates a QName instance

makeQNameInstance(java.lang.String, javax.xml.namespace.NamespaceContext)

Creates a QName instance from a standard Java namespace context. A namespace context object encapsulates a mapping of XML namespace prefixes and their definitions (namespace URIs). You can get an instance of NamespaceContext from an XmlElement its NamespaceContext property. The String argument is the qualified local name (including the prefix) for the new QName.

makeShortInstance(java.lang.Short)

Creates a duration instance

makeStringInstance(java.lang.String)

Creates a String instance

makeTimeInstance(gw.xml.date.XmlTime)

Creates a duration instance

makeUnsignedByteInstance(java.lang.Short)

Creates an unsigned byte instance

makeUnsignedIntInstance(java.lang.Long)

Creates an unsigned integer instance

makeUnsignedLongInstance(java.math.BigInteger)

Creates an unsigned long integer instance

makeUnsignedShortInstance(java.lang.Integer)

Creates an unsigned short integer instance

The following example creates instances of GDay, GMonthDay, GMonth, GYear and GYearMonth:

uses gw.xml.date.XmlDate
uses gw.xml.date.XmlDay
uses gw.xml.date.XmlMonth
uses gw.xml.date.XmlMonthDay
uses gw.xml.date.XmlYear
uses gw.xml.date.XmlYearMonth

var mydate = new XmlDate("2018-12-11")
var cal    = java.util.Calendar.getInstance()

var gd     = new XmlDay(cal, false)
var gmd    = new XmlMonthDay(cal, false)
var gm     = new XmlMonth(cal, false)
var gy     = new XmlYear(cal, false)
var gym    = new XmlYearMonth(cal, false)

print('Gday: ' + XmlSimpleValue.makeGDayInstance(gd))
print('GMonthDay: ' + XmlSimpleValue.makeGMonthDayInstance(gmd))
print('GMonth: ' + XmlSimpleValue.makeGMonthInstance(gm))
print('GYear: ' + XmlSimpleValue.makeGYearInstance(gy))
print('GYearMonth: ' + XmlSimpleValue.makeGYearMonthInstance(gym))
This code prints the following:
Gday: Simple value (gw.xml.date.XmlDay): ---11
GMonthDay: Simple value (gw.xml.date.XmlMonthDay): --12-11
GMonth: Simple value (gw.xml.date.XmlMonth): --12
GYear: Simple value (gw.xml.date.XmlYear): 2018
GYearMonth: Simple value (gw.xml.date.XmlYearMonth): 2018-12
The following examples create similar instances using strings, including the creation of a duration instance:
var mydate = new XmlDate("2018-12-11")
var gd     = new XmlDay("---11")
var gmd    = new XmlMonthDay("--12-11")
var gm     = new XmlMonth("--12")
var gy     = new XmlYear("2018")
var gym    = new XmlYearMonth("1900-03")
var dt     = new XmlDateTime("2000-01-12T12:13:14-07:00");
var dur    = new XmlDuration("P50MT50M50")

See also