public class EPPUtil
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DATE_FORMAT
Format used for the XML Schema date data type.
|
static java.lang.String |
DEFAULT_TIME_INSTANT_FORMAT
Default format used for the XML Schema
dateTime data type |
Constructor and Description |
---|
EPPUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
appendChildren(org.w3c.dom.Element aSource,
org.w3c.dom.Element aDest)
Appends the children Nodes of
aSource as children nodes of
aDest . |
static java.lang.String |
collapseWhitespace(java.lang.String inString)
Collapse Whitespace, which means that all leading and trailing whitespace
will be stripped, and all internal whitespace collapsed to single space
characters.
|
static java.math.BigDecimal |
decodeBigDecimal(org.w3c.dom.Element aElement)
Decode
BigDecimal , from an XML Element. |
static java.math.BigDecimal |
decodeBigDecimal(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName)
Decode
BigDecimal , by XML namespace and tag name, from an XML
Element. |
static java.lang.Boolean |
decodeBoolean(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName)
Decode
Boolean , by XML namespace and tag name, from an XML
Element. |
static boolean |
decodeBooleanAttr(org.w3c.dom.Element aElement,
java.lang.String aAttr)
Decodes a boolean attribute value given the
Element and
attribute name. |
static EPPCodecComponent |
decodeComp(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName,
java.lang.Class aClass)
Decode a
EPPCodecComponent , by XML namespace and tag name,
from an XML Element. |
static java.util.List |
decodeCompList(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName,
java.lang.Class aClass)
Decode a
List of EPPCodecComponent 's, by XML
namespace and tag name, from an XML Element. |
static java.util.Vector |
decodeCompVector(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName,
java.lang.Class aClass)
Decode a
Vector of EPPCodecComponent 's, by XML
namespace and tag name, from an XML Element. |
static java.util.Date |
decodeDate(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName)
Decode
Date , by XML namespace and tag name, from an XML
Element. |
static java.util.Date |
decodeDate(java.lang.String aDateValue)
Decode an XML Schema date data type (YYYY-MM-DD) to a Java Date object.
|
static java.util.List |
decodeEnumList(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName,
java.lang.Class aEnumType)
Decode a
List of Enum 's by XML namespace and tag
name, from an XML Element. |
static java.lang.Integer |
decodeInteger(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName)
Decode
Integer , by XML namespace and tag name, from an XML
Element. |
static java.util.List |
decodeIntegerList(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName)
Decode a
List of Integer 's by XML namespace and
tag name, from an XML Element. |
static java.util.List |
decodeList(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName)
Decode a
List of String 's by XML namespace and
tag name, from an XML Element. |
static java.lang.String |
decodeString(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName)
Decode
String , by XML namespace and tag name, from an XML
Element. |
static java.lang.String |
decodeStringAttr(org.w3c.dom.Element aElement,
java.lang.String aAttr)
Decodes a string attribute by name.
|
static java.lang.String |
decodeStringValue(org.w3c.dom.Element aElement)
Decode
String value from an XML Element. |
static java.util.Date |
decodeTimeInstant(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName)
Decode
Date , as date and time, by XML namespace and tag name,
from an XML Element. |
static java.util.Date |
decodeTimeInstant(java.lang.String aTimeInstant)
Decode an XML Schema timeInstant data type to a Java Date object.
|
static java.util.Vector |
decodeVector(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName)
Decode a
Vector of String 's by XML namespace and
tag name, from an XML Element. |
static java.lang.String |
encodeBase64(org.w3c.dom.Element aElement)
Base64 encode the XML
Element tree. |
static void |
encodeBigDecimal(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aElement,
java.math.BigDecimal aBigDecimal,
java.lang.String aFormat)
Encode a
Double in XML with a given XML namespace and tag
name. |
static void |
encodeBigDecimal(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.math.BigDecimal aBigDecimal,
java.lang.String aNS,
java.lang.String aTagName,
java.lang.String aFormat)
Encode a
Double in XML with a given XML namespace and tag
name. |
static void |
encodeBoolean(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.lang.Boolean aBoolean,
java.lang.String aNS,
java.lang.String aTagName)
Encode a
Boolean in XML with a given XML namespace and tag
name. |
static void |
encodeBooleanAttr(org.w3c.dom.Element aElement,
java.lang.String aAttr,
boolean aVal)
Encodes a boolean
Element attribute value. |
static void |
encodeComp(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
EPPCodecComponent aComp)
Encode a
EPPCodecComponent instance in XML. |
static void |
encodeCompList(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.util.List aList)
Encode a
List of EPPCodecComponent 's in XML. |
static void |
encodeCompVector(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.util.Vector aVector)
Encode a
Vector of EPPCodecComponent 's in XML. |
static java.lang.String |
encodeDate(java.util.Date aDate)
Encode a Java Date into an XML Schema date data type string.
|
static void |
encodeDate(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.util.Date aDate,
java.lang.String aNS,
java.lang.String aTagName)
Encode a
Date in XML with a given XML namespace and tag name. |
static void |
encodeInteger(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.lang.Integer aInteger,
java.lang.String aNS,
java.lang.String aTagName)
Encode a
Integer in XML with a given XML namespace and tag
name. |
static void |
encodeIntegerList(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.util.List aList,
java.lang.String aNS,
java.lang.String aTagName)
Encode a
List of Integer 's in XML with a given
XML namespace and tag name. |
static void |
encodeList(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.util.List aList,
java.lang.String aNS,
java.lang.String aTagName)
Encode a
List of String 's in XML with a given
XML namespace and tag name. |
static void |
encodeNill(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.lang.String aNS,
java.lang.String aTagName)
DOCUMENT ME!
|
static void |
encodeString(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.lang.String aString,
java.lang.String aNS,
java.lang.String aTagName)
Encode a
String in XML with a given XML namespace and tag
name. |
static void |
encodeStringList(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.util.List aList,
java.lang.String aNS,
java.lang.String aTagName) |
static java.lang.String |
encodeTimeInstant(java.util.Date aDate)
Encode a Java Date into an XML Schema timeInstant data type string.
|
static void |
encodeTimeInstant(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.util.Date aDate,
java.lang.String aNS,
java.lang.String aTagName)
Encode a
Date , as date and time, in XML with a given XML
namespace and tag name. |
static void |
encodeVector(org.w3c.dom.Document aDocument,
org.w3c.dom.Element aRoot,
java.util.Vector aVector,
java.lang.String aNS,
java.lang.String aTagName)
Encode a
Vector of String 's in XML with a given
XML namespace and tag name. |
static boolean |
equalLists(java.util.List aV1,
java.util.List aV2)
compares two
List instances. |
static boolean |
equalVectors(java.util.Vector aV1,
java.util.Vector aV2)
compares two
Vector instances. |
static org.w3c.dom.Element |
getElementByTagNameNS(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName)
Gets the first direct child element with a given tag name and XML
namespace.
|
static java.util.Vector |
getElementsByTagNameNS(org.w3c.dom.Element aElement,
java.lang.String aNS,
java.lang.String aTagName)
Gets all of the direct child element with a given tag name and XML
namespace.
|
static org.w3c.dom.Element |
getFirstElementChild(org.w3c.dom.Element aElement)
Gets the first DOM Element Node of the
aElement DOM Element. |
static java.lang.String |
getLocalName(java.lang.String aQualifiedName)
Gets the local name given the qualified element name.
|
static org.w3c.dom.Element |
getNextElementSibling(org.w3c.dom.Element aElement)
Gets the next sibling Element of a provided Element.
|
static java.lang.String |
getPrefix(java.lang.String aQualifiedName)
Gets the namespace prefix given a qualified name.
|
static java.lang.String |
getTextContent(org.w3c.dom.Node node)
A pass-thru to the getTextContent() method using a default value of false
for the required flag.
|
static java.lang.String |
getTextContent(org.w3c.dom.Node node,
boolean allowEmpty)
Return the text data within an XML tag.
|
static java.lang.String |
getTimeInstantFormat()
Gets the XML Schema
timeDate format used in
and #encodeTimeInstant(Document, Element,
Date, String, String) . |
static boolean |
listSubset(java.util.List aV1,
java.util.List aV2)
Determines if one
List is a subset of another
List . |
static java.lang.String |
removeWhitespace(java.lang.String inString)
Remove Whitespace, which means that all whitespace will be stripped.
|
static void |
setTimeInstantFormat(java.lang.String aTimeInstantFormat)
Sets the XML Schema
timeDate format used in
and #encodeTimeInstant(Document, Element,
Date, String, String) . |
static java.lang.String |
toString(org.w3c.dom.Element aElement)
Converts an
aElement to a String for printing. |
static java.lang.String |
toString(EPPCodecComponent aComponent)
Converts an
EPPCodecComponent to a String for
printing. |
static java.lang.String |
toStringNoIndent(org.w3c.dom.Element aElement)
Converts an
aElement to a String for printing
without pretty printing. |
static boolean |
vectorSubset(java.util.Vector aV1,
java.util.Vector aV2)
Determines if one
Vector is a subset of another
Vector . |
public static final java.lang.String DEFAULT_TIME_INSTANT_FORMAT
dateTime
data typepublic static final java.lang.String DATE_FORMAT
public static java.lang.String getTimeInstantFormat()
timeDate
format used in
and #encodeTimeInstant(Document, Element,
Date, String, String)
. The defauLt format is defined by the constant
DEFAULT_TIME_INSTANT_FORMAT
and it can be overridden using the
setTimeInstantFormat(String)
method.timeDate
format used in
and #encodeTimeInstant(Document,
Element, Date, String, String)
.public static void setTimeInstantFormat(java.lang.String aTimeInstantFormat)
timeDate
format used in
and #encodeTimeInstant(Document, Element,
Date, String, String)
. The format must follow the format supported by
SimpleDateFormat
.aTimeInstantFormat
- XML Schema timeDate
format supported by
SimpleDateFormat
.public static void appendChildren(org.w3c.dom.Element aSource, org.w3c.dom.Element aDest)
aSource
as children nodes of
aDest
.aSource
- Source Element tree to get children fromaDest
- Destination Element to append aSource
children.public static java.math.BigDecimal decodeBigDecimal(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName) throws EPPDecodeException
BigDecimal
, by XML namespace and tag name, from an XML
Element. The children elements of aElement
will be searched
for the specified aNS
namespace URI and the specified
aTagName
. The first XML element found will be decoded and
returned. If no element is found, null
is returned.aElement
- XML Element to scan. For example, the element could be
<domain:create>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name is "domain:name".BigDecimal
value if found; null
otherwise.EPPDecodeException
- Error decoding aElement
.public static java.math.BigDecimal decodeBigDecimal(org.w3c.dom.Element aElement) throws EPPDecodeException
BigDecimal
, from an XML Element. The
aElement
element will be decoded and returned. If element is
null
, null
is returned.aElement
- XML Element to decode.BigDecimal
value if aElement
is not
null
; null
otherwise.EPPDecodeException
- Error decoding aElement
.public static java.lang.Boolean decodeBoolean(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName) throws EPPDecodeException
Boolean
, by XML namespace and tag name, from an XML
Element. The children elements of aElement
will be searched
for the specified aNS
namespace URI and the specified
aTagName
. The first XML element found will be decoded and
returned. If no element is found, null
is returned.aElement
- XML Element to scan. For example, the element could be
<domain:create>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name is "domain:name".Boolean
value if found; null
otherwise.EPPDecodeException
- Error decoding aElement
.public static boolean decodeBooleanAttr(org.w3c.dom.Element aElement, java.lang.String aAttr) throws EPPDecodeException
Element
and
attribute name.aElement
- Element with the attribute to look foraAttr
- Attribute nameEPPDecodeException
- Cound not find attribute or the attribute value is not a
valid boolean valuepublic static java.lang.String decodeStringAttr(org.w3c.dom.Element aElement, java.lang.String aAttr)
null
is returned.aElement
- Element to search for the attributeaAttr
- Attribute name to search forString
value if exists; null
otherwise.public static EPPCodecComponent decodeComp(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName, java.lang.Class aClass) throws EPPDecodeException
EPPCodecComponent
, by XML namespace and tag name,
from an XML Element. The children elements of aElement
will
be searched for the specified aNS
namespace URI and the
specified aTagName
. There first XML element found will be
used to initial and instance of aClass
.aElement
- XML Element to scan. For example, the element could be
<domain:update>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name servers is
"domain:server".aClass
- Class to instantiate for a found XML element. This must be a
class that implements EPPCodecComponent
aClass
that represents the found XML
elements if found; null
otherwise.EPPDecodeException
- Error decoding aElement
.public static java.util.List decodeCompList(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName, java.lang.Class aClass) throws EPPDecodeException
List
of EPPCodecComponent
's, by XML
namespace and tag name, from an XML Element. The children elements of
aElement
will be searched for the specified aNS
namespace URI and the specified aTagName
. Each XML element
found will result in the instantiation of aClass
, which will
decode the associated XML element and added to the returned
List
.aElement
- XML Element to scan. For example, the element could be
<domain:add>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the contact elements of
>domain:add> is "domain:contact".aClass
- Class to instantiate for each found XML element. This must be a
class that implements EPPCodecComponent
List
of EPPCodecComponent
elements
representing the found XML elements.EPPDecodeException
- Error decoding aElement
.public static java.util.Vector decodeCompVector(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName, java.lang.Class aClass) throws EPPDecodeException
Vector
of EPPCodecComponent
's, by XML
namespace and tag name, from an XML Element. The children elements of
aElement
will be searched for the specified aNS
namespace URI and the specified aTagName
. Each XML element
found will result in the instantiation of aClass
, which will
decode the associated XML element and added to the returned
Vector
.aElement
- XML Element to scan. For example, the element could be
<domain:add>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the contact elements of
>domain:add> is "domain:contact".aClass
- Class to instantiate for each found XML element. This must be a
class that implements EPPCodecComponent
Vector
of EPPCodecComponent
elements
representing the found XML elements.EPPDecodeException
- Error decoding aElement
.public static java.util.Date decodeDate(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName) throws EPPDecodeException
Date
, by XML namespace and tag name, from an XML
Element. The children elements of aElement
will be searched
for the specified aNS
namespace URI and the specified
aTagName
. The first XML element found will be decoded and
returned. If no element is found, null
is returned. The
format used for decoding the date is defined by the constant
EPPUtil.DATE_FORMAT
.aElement
- XML Element to scan. For example, the element could be
<trans-id>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:epp".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the transaction Id date is "date".Date
value if found; null
otherwise.EPPDecodeException
- Error decoding aElement
.public static java.util.Date decodeDate(java.lang.String aDateValue)
aDateValue
- XML Schema date data type string (YYYY-MM-DD).public static java.lang.Integer decodeInteger(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName) throws EPPDecodeException
Integer
, by XML namespace and tag name, from an XML
Element. The children elements of aElement
will be searched
for the specified aNS
namespace URI and the specified
aTagName
. The first XML element found will be decoded and
returned. If no element is found, null
is returned.aElement
- XML Element to scan. For example, the element could be
<domain:create>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name is "domain:name".Integer
value if found; null
otherwise.EPPDecodeException
- Error decoding aElement
.public static java.util.List decodeEnumList(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName, java.lang.Class aEnumType) throws EPPDecodeException
List
of Enum
's by XML namespace and tag
name, from an XML Element. The children elements of aElement
will be searched for the specified aNS
namespace URI and the
specified aTagName
. Each XML element found will be decoded
and added to the returned List
of Enum
values
using the Enum.valueOf(Class, String)
method.aElement
- XML Element to scan. For example, the element could be
<domain:update>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name servers is
"domain:server".aEnumType
- Enum type associated with tag.List
of Enum
elements that match the
aEnumType
representing matching the XML element
values.EPPDecodeException
- Error decoding aElement
.public static java.util.List decodeList(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName) throws EPPDecodeException
List
of String
's by XML namespace and
tag name, from an XML Element. The children elements of
aElement
will be searched for the specified aNS
namespace URI and the specified aTagName
. Each XML element
found will be decoded and added to the returned List
. Empty
child elements, will result in empty string ("") return List
elements.aElement
- XML Element to scan. For example, the element could be
<domain:update>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name servers is
"domain:server".List
of String
elements representing the
text nodes of the found XML elements.EPPDecodeException
- Error decoding aElement
.public static java.lang.String decodeString(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName) throws EPPDecodeException
String
, by XML namespace and tag name, from an XML
Element. The children elements of aElement
will be searched
for the specified aNS
namespace URI and the specified
aTagName
. The first XML element found will be decoded and
returned. If no element is found, null
is returned.aElement
- XML Element to scan. For example, the element could be
<domain:create>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name is "domain:name".String
value if found; null
otherwise.EPPDecodeException
- Error decoding aElement
.public static java.lang.String decodeStringValue(org.w3c.dom.Element aElement)
String
value from an XML Element.aElement
- XML Element to get the String
value.String
value if set; "" other.EPPDecodeException
- Error decoding aElement
.public static java.util.Date decodeTimeInstant(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName) throws EPPDecodeException
Date
, as date and time, by XML namespace and tag name,
from an XML Element. The children elements of aElement
will
be searched for the specified aNS
namespace URI and the
specified aTagName
. The first XML element found will be
decoded and returned. If no element is found, null
is
returned. The format used for decoding the date is defined by the constant
EPPUtil.TIME_INSTANT_FORMAT
.aElement
- XML Element to scan. For example, the element could be
<trans-id>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:epp".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the transaction Id date is "date".Date
value as date and time if found;
null
otherwise.EPPDecodeException
- Error decoding aElement
.public static java.util.Date decodeTimeInstant(java.lang.String aTimeInstant)
aTimeInstant
- XML Schema timeInstant data type string.aTimeInstant
format is valid;
null
otherwisepublic static java.util.Vector decodeVector(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName) throws EPPDecodeException
Vector
of String
's by XML namespace and
tag name, from an XML Element. The children elements of
aElement
will be searched for the specified aNS
namespace URI and the specified aTagName
. Each XML element
found will be decoded and added to the returned Vector
. Empty
child elements, will result in empty string ("") return
Vector
elements.aElement
- XML Element to scan. For example, the element could be
<domain:update>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name servers is
"domain:server".Vector
of String
elements representing
the text nodes of the found XML elements.EPPDecodeException
- Error decoding aElement
.public static void encodeBigDecimal(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.math.BigDecimal aBigDecimal, java.lang.String aNS, java.lang.String aTagName, java.lang.String aFormat) throws EPPEncodeException
Double
in XML with a given XML namespace and tag
name. Takes an optional argument for the format of the Double, if not
provided then it uses #0.00 which formats the double to 2 decimal places.aDocument
- DOM Document of aRoot
. This parameter also acts as
a factory for XML elements.aRoot
- XML Element to add children nodes to. For example, the root node
could be <domain:update>aBigDecimal
- Double
to add.aNS
- XML namespace of the element. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name is "domain:name".aFormat
- Format to use following the DecimalFormat
format. If
null
is passed, the default format of
"#0.00" is used.EPPEncodeException
- Error encoding the Double
.public static void encodeBigDecimal(org.w3c.dom.Document aDocument, org.w3c.dom.Element aElement, java.math.BigDecimal aBigDecimal, java.lang.String aFormat) throws EPPEncodeException
Double
in XML with a given XML namespace and tag
name. Takes an optional argument for the format of the Double, if not
provided then it uses #0.00 which formats the double to 2 decimal places.aElement
- XML Element to add the text node encoded with the
BigDecimal
value.aBigDecimal
- Double
to encode into the text node of the element.aFormat
- Format to use following the DecimalFormat
format. If
null
is passed, the default format of
"#0.00" is used.EPPEncodeException
- Error encoding the Double
.public static void encodeBoolean(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.lang.Boolean aBoolean, java.lang.String aNS, java.lang.String aTagName) throws EPPEncodeException
Boolean
in XML with a given XML namespace and tag
name. If aBoolean is null
an element is not added.aDocument
- DOM Document of aRoot
. This parameter also acts as
a factory for XML elements.aRoot
- XML Element to add children nodes to. For example, the root node
could be <domain:update>aBoolean
- Boolean
to add.aNS
- XML namespace of the element. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name is "domain:name".EPPEncodeException
- Error encoding the Boolean
.public static void encodeBooleanAttr(org.w3c.dom.Element aElement, java.lang.String aAttr, boolean aVal)
Element
attribute value. The attribute is
set to "1" with a value of true
and is set to
"0" with a value of false
.aElement
- Element to add attribute toaAttr
- Attribute nameaVal
- Attribute boolean valuepublic static void encodeComp(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, EPPCodecComponent aComp) throws EPPEncodeException
EPPCodecComponent
instance in XML. The component is
first checked for not being null
, than it will be appended as
a child of aRoot
.aDocument
- DOM Document of aRoot
. This parameter also acts as
a factory for XML elements.aRoot
- XML Element to add to. For example, the root node could be
<domain:update>aComp
- EPPCodecComponent's
to add.EPPEncodeException
- Error encoding EPPCodecComponent
.public static void encodeCompList(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.util.List aList) throws EPPEncodeException
List
of EPPCodecComponent
's in XML.
Each aList
element will be encoded and added to
aRoot
.aDocument
- DOM Document of aRoot
. This parameter also acts as
a factory for XML elements.aRoot
- XML Element to add children nodes to. For example, the root node
could be <domain:update>aList
- List
of EPPCodecComponent's
to add.EPPEncodeException
- Error encoding the List
of
EPPCodecComponent
's.public static void encodeCompVector(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.util.Vector aVector) throws EPPEncodeException
Vector
of EPPCodecComponent
's in XML.
Each aVector
element will be encoded and added to
aRoot
.aDocument
- DOM Document of aRoot
. This parameter also acts as
a factory for XML elements.aRoot
- XML Element to add children nodes to. For example, the root node
could be <domain:update>aVector
- Vector
of EPPCodecComponent's
to add.EPPEncodeException
- Error encoding the Vector
of
EPPCodecComponent
's.public static java.lang.String encodeDate(java.util.Date aDate)
aDate
- Java Date to encode into a XML Schema date data type string.public static void encodeDate(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.util.Date aDate, java.lang.String aNS, java.lang.String aTagName) throws EPPEncodeException
Date
in XML with a given XML namespace and tag name.
The format used for encoding the date is defined by the constant
EPPUtil.DATE_FORMAT
.aDocument
- DOM Document of aRoot
. This parameter also acts as
a factory for XML elements.aRoot
- XML Element to add children nodes to. For example, the root node
could be <domain:update>aDate
- Date
to add.aNS
- XML namespace of the element. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name is "domain:name".EPPEncodeException
- Error encoding Date
.public static void encodeList(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.util.List aList, java.lang.String aNS, java.lang.String aTagName) throws EPPEncodeException
List
of String
's in XML with a given
XML namespace and tag name.aDocument
- DOM Document of aRoot
. This parameter also acts as
a factory for XML elements.aRoot
- XML Element to add children nodes to. For example, the root node
could be <domain:update>aList
- List
of String's
to add.aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name servers is
"domain:server".EPPEncodeException
- Error encoding the List
of String
's.public static void encodeNill(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.lang.String aNS, java.lang.String aTagName) throws EPPEncodeException
aDocument
- DOCUMENT ME!aRoot
- DOCUMENT ME!aNS
- DOCUMENT ME!aTagName
- DOCUMENT ME!EPPEncodeException
- DOCUMENT ME!public static void encodeString(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.lang.String aString, java.lang.String aNS, java.lang.String aTagName) throws EPPEncodeException
String
in XML with a given XML namespace and tag
name.aDocument
- DOM Document of aRoot
. This parameter also acts as
a factory for XML elements.aRoot
- XML Element to add children nodes to. For example, the root node
could be <domain:update>aString
- String
to add.aNS
- XML namespace of the element. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name is "domain:name".EPPEncodeException
- Error encoding the String
.public static void encodeInteger(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.lang.Integer aInteger, java.lang.String aNS, java.lang.String aTagName) throws EPPEncodeException
Integer
in XML with a given XML namespace and tag
name. If the Integer
is null
nothing will be
encoded.aDocument
- DOM Document of aRoot
. This parameter also acts as
a factory for XML elements.aRoot
- XML Element to add children nodes to. For example, the root node
could be <domain:update>aInteger
- Integer
to add.aNS
- XML namespace of the element. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name is "domain:name".EPPEncodeException
- Error encoding the Integer
.public static void encodeStringList(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.util.List aList, java.lang.String aNS, java.lang.String aTagName)
public static java.lang.String encodeTimeInstant(java.util.Date aDate)
aDate
- Java Date to encode into a XML Schema timeInstant data type
string.public static void encodeTimeInstant(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.util.Date aDate, java.lang.String aNS, java.lang.String aTagName) throws EPPEncodeException
Date
, as date and time, in XML with a given XML
namespace and tag name. The format used for encoding the date is defined
by the constant EPPUtil.TIME_INSTANT_FORMAT
.aDocument
- DOM Document of aRoot
. This parameter also acts as
a factory for XML elements.aRoot
- XML Element to add children nodes to. For example, the root node
could be <domain:expire-data>aDate
- Date
as date and time to add.aNS
- XML namespace of the element. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain expiration date and
time is "domain:expiration-date".EPPEncodeException
- Error encoding Date
.public static void encodeVector(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.util.Vector aVector, java.lang.String aNS, java.lang.String aTagName) throws EPPEncodeException
Vector
of String
's in XML with a given
XML namespace and tag name.aDocument
- DOM Document of aRoot
. This parameter also acts as
a factory for XML elements.aRoot
- XML Element to add children nodes to. For example, the root node
could be <domain:update>aVector
- Vector
of String's
to add.aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name servers is
"domain:server".EPPEncodeException
- Error encoding the Vector
of
String
's.public static boolean equalLists(java.util.List aV1, java.util.List aV2)
List
instances. The Java 1.1 List
class does not implement the equals
methods, so
equalLists
was written to implement equals
of
two Lists
(aV1 and aV2). This method is not need for Java 2.aV1
- First List instance to compare.aV2
- Second List instance to compare.true
if List's are equal; false
otherwise.public static boolean equalVectors(java.util.Vector aV1, java.util.Vector aV2)
Vector
instances. The Java 1.1
Vector
class does not implement the equals
methods, so equalVectors
was written to implement
equals
of two Vectors
(aV1 and aV2). This method
is not need for Java 2.aV1
- First Vector instance to compare.aV2
- Second Vector instance to compare.true
if Vector's are equal; false
otherwise.public static org.w3c.dom.Element getElementByTagNameNS(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName)
aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name to scan for.Element
if found; null
otherwise.public static java.util.Vector getElementsByTagNameNS(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName)
aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name to scan for.Vector
of Node
instances that are
elements and have the specified tag name and XML namespace.public static java.lang.String getLocalName(java.lang.String aQualifiedName)
aQualifiedName
- Qualified name of the element like domain:name
. A
localhost like name
can be passed without error.public static java.lang.String getPrefix(java.lang.String aQualifiedName)
aQualifiedName
- Qualified name of the element like domain:name
.public static org.w3c.dom.Element getFirstElementChild(org.w3c.dom.Element aElement)
aElement
DOM Element.aElement
- Element to scan for the first element.null
otherwise.public static org.w3c.dom.Element getNextElementSibling(org.w3c.dom.Element aElement)
aElement
- Element to start scan for the next Element.null
otherwise.public static java.lang.String getTextContent(org.w3c.dom.Node node) throws EPPDecodeException
EPPDecodeException
public static java.lang.String getTextContent(org.w3c.dom.Node node, boolean allowEmpty) throws EPPDecodeException
For reference:
<tag></tag> => child is null
<tag/> => child is null
<tag> </tag> => value is empty
EPPDecodeException
public static boolean listSubset(java.util.List aV1, java.util.List aV2)
List
is a subset of another
List
. If every element in aV1
is in
aV2
return true
; otherwise return
false
.aV1
- Subset List
to compare against aV2
aV2
- Superset List
to compare against aV1
true
if aV1
is a subset of
aV2
; false
otherwise.public static java.lang.String toString(EPPCodecComponent aComponent)
EPPCodecComponent
to a String
for
printing. Each EPPCodecComponent
can use this utility method
to implement Object.toString()
.aComponent
- a concrete EPPCodecComponent
instanceString
representation of
EPPCodecComponent
if successful; "ERROR"
String
otherwise.public static java.lang.String toString(org.w3c.dom.Element aElement)
aElement
to a String
for printing.aElement
- Element
to printString
representation of Element
if
successful; "ERROR" String
otherwise.public static java.lang.String toStringNoIndent(org.w3c.dom.Element aElement)
aElement
to a String
for printing
without pretty printing.aElement
- Element
to printString
representation of Element
if
successful; "ERROR" String
otherwise.public static boolean vectorSubset(java.util.Vector aV1, java.util.Vector aV2)
Vector
is a subset of another
Vector
. If every element in aV1
is in
aV2
return true
; otherwise return
false
.aV1
- Subset Vector
to compare against aV2
aV2
- Superset Vector
to compare against aV1
true
if aV1
is a subset of
aV2
; false
otherwise.public static java.util.List decodeIntegerList(org.w3c.dom.Element aElement, java.lang.String aNS, java.lang.String aTagName) throws EPPDecodeException
List
of Integer
's by XML namespace and
tag name, from an XML Element. The children elements of
aElement
will be searched for the specified aNS
namespace URI and the specified aTagName
. Each XML element
found will be decoded and added to the returned List
. Empty
child elements, will result in an EPPDecodeException
.aElement
- XML Element to scan. For example, the element could be
<domain:update>aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name servers is
"domain:server".List
of Integer
elements representing
the text nodes of the found XML elements.EPPDecodeException
- Error decoding aElement
.public static void encodeIntegerList(org.w3c.dom.Document aDocument, org.w3c.dom.Element aRoot, java.util.List aList, java.lang.String aNS, java.lang.String aTagName) throws EPPEncodeException
List
of Integer
's in XML with a given
XML namespace and tag name.aDocument
- DOM Document of aRoot
. This parameter also acts as
a factory for XML elements.aRoot
- XML Element to add children nodes to. For example, the root node
could be <domain:update>aList
- List
of Integer
's to add.aNS
- XML namespace of the elements. For example, for domain element
this is "urn:iana:xmlns:domain".aTagName
- Tag name of the element including an optional namespace prefix.
For example, the tag name for the domain name servers is
"domain:server".EPPEncodeException
- Error encoding the List
of Integer
's.public static java.lang.String collapseWhitespace(java.lang.String inString)
inString
- String
to be collapsedString
with whitespace collapsed, or null when result
is emptypublic static java.lang.String removeWhitespace(java.lang.String inString)
inString
- String
from which to remove whitespaceString
with whitespace removed, or null when result
is emptypublic static java.lang.String encodeBase64(org.w3c.dom.Element aElement) throws java.lang.Exception
Element
tree.aElement
- Root element to encode in Base64Element
tree.java.lang.Exception
- Error encoding the Element
Copyright © VeriSign Inc. All Rights Reserved.