Package com.verisign.epp.codec.gen
Class EPPUtil
java.lang.Object
com.verisign.epp.codec.gen.EPPUtil
Provides a set of utility static methods for use by the EPP Codec classes.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendChildren(Element aSource, Element aDest) Appends the children Nodes ofaSourceas children nodes ofaDest.static StringcollapseWhitespace(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 BigDecimaldecodeBigDecimal(Element aElement) DecodeBigDecimal, from an XML Element.static BigDecimaldecodeBigDecimal(Element aElement, String aNS, String aTagName) DecodeBigDecimal, by XML namespace and tag name, from an XML Element.static BooleandecodeBoolean(Element aElement, String aNS, String aTagName) DecodeBoolean, by XML namespace and tag name, from an XML Element.static booleandecodeBooleanAttr(Element aElement, String aAttr) Decodes a boolean attribute value given theElementand attribute name.static EPPCodecComponentdecodeComp(Element aElement, String aNS, String aTagName, Class aClass) Decode aEPPCodecComponent, by XML namespace and tag name, from an XML Element.static ListdecodeCompList(Element aElement, String aNS, String aTagName, Class aClass) Decode aListofEPPCodecComponent's, by XML namespace and tag name, from an XML Element.static VectordecodeCompVector(Element aElement, String aNS, String aTagName, Class aClass) Decode aVectorofEPPCodecComponent's, by XML namespace and tag name, from an XML Element.static DatedecodeDate(String aDateValue) Decode an XML Schema date data type (YYYY-MM-DD) to a Java Date object.static DatedecodeDate(Element aElement, String aNS, String aTagName) DecodeDate, by XML namespace and tag name, from an XML Element.static ListdecodeEnumList(Element aElement, String aNS, String aTagName, Class aEnumType) Decode aListofEnum's by XML namespace and tag name, from an XML Element.static IntegerdecodeInteger(Element aElement) DecodeIntegerfromaElementparameter.static IntegerdecodeInteger(Element aElement, String aNS, String aTagName) DecodeInteger, by XML namespace and tag name, from an XML Element.static ListdecodeIntegerList(Element aElement, String aNS, String aTagName) Decode aListofInteger's by XML namespace and tag name, from an XML Element.static ListdecodeList(Element aElement, String aNS, String aTagName) Decode aListofString's by XML namespace and tag name, from an XML Element.static StringdecodeString(Element aElement, String aNS, String aTagName) DecodeString, by XML namespace and tag name, from an XML Element.static StringdecodeStringAttr(Element aElement, String aAttr) Decodes a string attribute by name.static StringdecodeStringValue(Element aElement) DecodeStringvalue from an XML Element.static DatedecodeTimeInstant(String aTimeInstant) Decode an XML Schema timeInstant data type to a Java Date object.static DatedecodeTimeInstant(Element aElement, String aNS, String aTagName) DecodeDate, as date and time, by XML namespace and tag name, from an XML Element.static VectordecodeVector(Element aElement, String aNS, String aTagName) Decode aVectorofString's by XML namespace and tag name, from an XML Element.static StringencodeBase64(Element aElement) Base64 encode the XMLElementtree.static voidencodeBigDecimal(Document aDocument, Element aElement, BigDecimal aBigDecimal, String aFormat) Encode aDoublein XML with a given XML namespace and tag name.static voidencodeBigDecimal(Document aDocument, Element aRoot, BigDecimal aBigDecimal, String aNS, String aTagName, String aFormat) Encode aDoublein XML with a given XML namespace and tag name.static voidEncode aBooleanin XML with a given XML namespace and tag name.static voidencodeBooleanAttr(Element aElement, String aAttr, boolean aVal) Encodes a booleanElementattribute value.static voidencodeComp(Document aDocument, Element aRoot, EPPCodecComponent aComp) Encode aEPPCodecComponentinstance in XML.static voidencodeCompList(Document aDocument, Element aRoot, List aList) Encode aListofEPPCodecComponent's in XML.static voidencodeCompVector(Document aDocument, Element aRoot, Vector aVector) Encode aVectorofEPPCodecComponent's in XML.static StringencodeDate(Date aDate) Encode a Java Date into an XML Schema date data type string.static voidEncode aDatein XML with a given XML namespace and tag name.static voidEncode aIntegerin XML with a given XML namespace and tag name.static voidEncode aListofInteger's in XML with a given XML namespace and tag name.static voidEncode aListofString's in XML with a given XML namespace and tag name.static voidencodeNill(Document aDocument, Element aRoot, String aNS, String aTagName) DOCUMENT ME!static voidEncode aStringin XML with a given XML namespace and tag name.static voidstatic StringencodeTimeInstant(Date aDate) Encode a Java Date into an XML Schema timeInstant data type string.static voidEncode aDate, as date and time, in XML with a given XML namespace and tag name.static voidEncode aVectorofString's in XML with a given XML namespace and tag name.static booleanequalLists(List aV1, List aV2) compares twoListinstances.static booleanequalVectors(Vector aV1, Vector aV2) compares twoVectorinstances.findDuplicateExtNamespaces(List<EPPCodecComponent> aExtensions) Find the set of duplicate EPP extensions based on the list of EPP extensions.findExtNamespaces(List<EPPCodecComponent> aExtensions, List<String> aFilterExtNamespaces) Find the set of unique EPP extension XML namespaces based on the list of EPP extensions and the optional use of a list of XML namespaces to filter.findExtNamespaceSuffixes(List<EPPCodecComponent> aExtensions, List<String> aFilterExtNamespaceSuffixes) Find the set of unique EPP extension XML namespace suffixes based on the list of EPP extensions and the optional use of a list of XML namespace suffixes to filter.findUnsupportedExtNamespaces(List<String> aSupportedExtNamespaces, List<EPPCodecComponent> aExtensions) Find the set of unsupported EPP extensions based on passing the list of supported extension XML namespaces and the list of EPP extensions.findUnsupportedExtNamespaceSuffixes(List<String> aSupportedExtNamespaceSuffixes, List<EPPCodecComponent> aExtensions) Find the set of unsupported EPP extensions based on passing the list of supported extension XML namespace suffixes and the list of EPP extensions.static ElementgetElementByTagNameNS(Element aElement, String aNS, String aTagName) Gets the first direct child element with a given tag name and XML namespace.static VectorgetElementsByTagNameNS(Element aElement, String aNS, String aTagName) Gets all of the direct child element with a given tag name and XML namespace.static ElementgetFirstElementChild(Element aElement) Gets the first DOM Element Node of theaElementDOM Element.static StringgetLocalName(String aQualifiedName) Gets the local name given the qualified element name.static ElementgetNextElementSibling(Element aElement) Gets the next sibling Element of a provided Element.static StringGets the namespace prefix given a qualified name.static StringgetTextContent(Node node) A pass-thru to the getTextContent() method using a default value of false for the required flag.static StringgetTextContent(Node node, boolean allowEmpty) Return the text data within an XML tag.
<id>12345</id> yields the String "12345"
If the node==null, child==null, value==null, or value=="" => Exception
UNLESS allowEmpty, in which case return ""static StringGets the XML SchematimeDateformat used inand #encodeTimeInstant(Document, Element, Date, String, String).static booleanlistSubset(List aV1, List aV2) Determines if oneListis a subset of anotherList.static StringnamespaceToNamespaceSuffix(String aNamespace) Convert an XML namespace to an XML namespace suffix.static StringnamespaceToNamespaceSuffixBasename(String aNamespace) Convert an XML namespace to an XML namespace suffix baseename.static StringremoveWhitespace(String inString) Remove Whitespace, which means that all whitespace will be stripped.static voidsetTimeInstantFormat(String aTimeInstantFormat) Sets the XML SchematimeDateformat used inand #encodeTimeInstant(Document, Element, Date, String, String).static StringtoString(EPPCodecComponent aComponent) Converts anEPPCodecComponentto aStringfor printing.static StringConverts anaElementto aStringfor printing.static StringtoStringNoIndent(Element aElement) Converts anaElementto aStringfor printing without pretty printing.static booleanvectorSubset(Vector aV1, Vector aV2) Determines if oneVectoris a subset of anotherVector.
-
Field Details
-
DEFAULT_TIME_INSTANT_FORMAT
Default format used for the XML SchemadateTimedata type- See Also:
-
DATE_FORMAT
Format used for the XML Schema date data type.- See Also:
-
-
Constructor Details
-
EPPUtil
public EPPUtil()
-
-
Method Details
-
getTimeInstantFormat
Gets the XML SchematimeDateformat used inand #encodeTimeInstant(Document, Element, Date, String, String). The defauLt format is defined by the constantDEFAULT_TIME_INSTANT_FORMATand it can be overridden using thesetTimeInstantFormat(String)method.- Returns:
- XML Schema
timeDateformat used inand #encodeTimeInstant(Document, Element, Date, String, String).
-
setTimeInstantFormat
Sets the XML SchematimeDateformat used inand #encodeTimeInstant(Document, Element, Date, String, String). The format must follow the format supported bySimpleDateFormat.- Parameters:
aTimeInstantFormat- XML SchematimeDateformat supported bySimpleDateFormat.
-
appendChildren
Appends the children Nodes ofaSourceas children nodes ofaDest.- Parameters:
aSource- Source Element tree to get children fromaDest- Destination Element to appendaSourcechildren.
-
decodeBigDecimal
public static BigDecimal decodeBigDecimal(Element aElement, String aNS, String aTagName) throws EPPDecodeException DecodeBigDecimal, by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. The first XML element found will be decoded and returned. If no element is found,nullis returned.- Parameters:
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".- Returns:
BigDecimalvalue if found;nullotherwise.- Throws:
EPPDecodeException- Error decodingaElement.
-
decodeBigDecimal
DecodeBigDecimal, from an XML Element. TheaElementelement will be decoded and returned. If element isnull,nullis returned.- Parameters:
aElement- XML Element to decode.- Returns:
BigDecimalvalue ifaElementis notnull;nullotherwise.- Throws:
EPPDecodeException- Error decodingaElement.
-
decodeBoolean
public static Boolean decodeBoolean(Element aElement, String aNS, String aTagName) throws EPPDecodeException DecodeBoolean, by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. The first XML element found will be decoded and returned. If no element is found,nullis returned.- Parameters:
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".- Returns:
Booleanvalue if found;nullotherwise.- Throws:
EPPDecodeException- Error decodingaElement.
-
decodeBooleanAttr
Decodes a boolean attribute value given theElementand attribute name.- Parameters:
aElement- Element with the attribute to look foraAttr- Attribute name- Returns:
- Decoded boolean value
- Throws:
EPPDecodeException- Cound not find attribute or the attribute value is not a valid boolean value
-
decodeStringAttr
Decodes a string attribute by name. If the attribute is not found,nullis returned.- Parameters:
aElement- Element to search for the attributeaAttr- Attribute name to search for- Returns:
- Attribute
Stringvalue if exists;nullotherwise.
-
decodeComp
public static EPPCodecComponent decodeComp(Element aElement, String aNS, String aTagName, Class aClass) throws EPPDecodeException Decode aEPPCodecComponent, by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. There first XML element found will be used to initial and instance ofaClass.- Parameters:
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 implementsEPPCodecComponent- Returns:
- Instance of
aClassthat represents the found XML elements if found;nullotherwise. - Throws:
EPPDecodeException- Error decodingaElement.
-
decodeCompList
public static List decodeCompList(Element aElement, String aNS, String aTagName, Class aClass) throws EPPDecodeException Decode aListofEPPCodecComponent's, by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. Each XML element found will result in the instantiation ofaClass, which will decode the associated XML element and added to the returnedList.- Parameters:
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 implementsEPPCodecComponent- Returns:
ListofEPPCodecComponentelements representing the found XML elements.- Throws:
EPPDecodeException- Error decodingaElement.
-
decodeCompVector
public static Vector decodeCompVector(Element aElement, String aNS, String aTagName, Class aClass) throws EPPDecodeException Decode aVectorofEPPCodecComponent's, by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. Each XML element found will result in the instantiation ofaClass, which will decode the associated XML element and added to the returnedVector.- Parameters:
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 implementsEPPCodecComponent- Returns:
VectorofEPPCodecComponentelements representing the found XML elements.- Throws:
EPPDecodeException- Error decodingaElement.
-
decodeDate
public static Date decodeDate(Element aElement, String aNS, String aTagName) throws EPPDecodeException DecodeDate, by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. The first XML element found will be decoded and returned. If no element is found,nullis returned. The format used for decoding the date is defined by the constantEPPUtil.DATE_FORMAT.- Parameters:
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".- Returns:
Datevalue if found;nullotherwise.- Throws:
EPPDecodeException- Error decodingaElement.
-
decodeDate
Decode an XML Schema date data type (YYYY-MM-DD) to a Java Date object.- Parameters:
aDateValue- XML Schema date data type string (YYYY-MM-DD).- Returns:
- Java Date object.
-
decodeInteger
DecodeIntegerfromaElementparameter.- Parameters:
aElement- XML Element to scan for theIntegervalue.- Returns:
Integervalue if found;nullotherwise.- Throws:
EPPDecodeException- Error decodingaElement.
-
decodeInteger
public static Integer decodeInteger(Element aElement, String aNS, String aTagName) throws EPPDecodeException DecodeInteger, by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. The first XML element found will be decoded and returned. If no element is found,nullis returned.- Parameters:
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".- Returns:
Integervalue if found;nullotherwise.- Throws:
EPPDecodeException- Error decodingaElement.
-
decodeEnumList
public static List decodeEnumList(Element aElement, String aNS, String aTagName, Class aEnumType) throws EPPDecodeException Decode aListofEnum's by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. Each XML element found will be decoded and added to the returnedListofEnumvalues using theEnum.valueOf(Class, String)method.- Parameters:
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.- Returns:
ListofEnumelements that match theaEnumTyperepresenting matching the XML element values.- Throws:
EPPDecodeException- Error decodingaElement.
-
decodeList
public static List decodeList(Element aElement, String aNS, String aTagName) throws EPPDecodeException Decode aListofString's by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. Each XML element found will be decoded and added to the returnedList. Empty child elements, will result in empty string ("") returnListelements.- Parameters:
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".- Returns:
ListofStringelements representing the text nodes of the found XML elements.- Throws:
EPPDecodeException- Error decodingaElement.
-
decodeString
public static String decodeString(Element aElement, String aNS, String aTagName) throws EPPDecodeException DecodeString, by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. The first XML element found will be decoded and returned. If no element is found,nullis returned.- Parameters:
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".- Returns:
Stringvalue if found;nullotherwise.- Throws:
EPPDecodeException- Error decodingaElement.
-
decodeStringValue
DecodeStringvalue from an XML Element.- Parameters:
aElement- XML Element to get theStringvalue.- Returns:
Stringvalue if set; "" other.
-
decodeTimeInstant
public static Date decodeTimeInstant(Element aElement, String aNS, String aTagName) throws EPPDecodeException DecodeDate, as date and time, by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. The first XML element found will be decoded and returned. If no element is found,nullis returned. The format used for decoding the date is defined by the constantEPPUtil.TIME_INSTANT_FORMAT.- Parameters:
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".- Returns:
Datevalue as date and time if found;nullotherwise.- Throws:
EPPDecodeException- Error decodingaElement.
-
decodeTimeInstant
Decode an XML Schema timeInstant data type to a Java Date object.- Parameters:
aTimeInstant- XML Schema timeInstant data type string.- Returns:
- Java Date object if
aTimeInstantformat is valid;nullotherwise
-
decodeVector
public static Vector decodeVector(Element aElement, String aNS, String aTagName) throws EPPDecodeException Decode aVectorofString's by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. Each XML element found will be decoded and added to the returnedVector. Empty child elements, will result in empty string ("") returnVectorelements.- Parameters:
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".- Returns:
VectorofStringelements representing the text nodes of the found XML elements.- Throws:
EPPDecodeException- Error decodingaElement.
-
encodeBigDecimal
public static void encodeBigDecimal(Document aDocument, Element aRoot, BigDecimal aBigDecimal, String aNS, String aTagName, String aFormat) throws EPPEncodeException Encode aDoublein 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.- Parameters:
aDocument- DOM Document ofaRoot. 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-Doubleto 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 theDecimalFormatformat. Ifnullis passed, the default format of "#0.00" is used.- Throws:
EPPEncodeException- Error encoding theDouble.
-
encodeBigDecimal
public static void encodeBigDecimal(Document aDocument, Element aElement, BigDecimal aBigDecimal, String aFormat) throws EPPEncodeException Encode aDoublein 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.- Parameters:
aDocument- DOM Document ofaRoot. This parameter also acts as a factory for XML elements.aElement- XML Element to add the text node encoded with theBigDecimalvalue.aBigDecimal-Doubleto encode into the text node of the element.aFormat- Format to use following theDecimalFormatformat. Ifnullis passed, the default format of "#0.00" is used.- Throws:
EPPEncodeException- Error encoding theDouble.
-
encodeBoolean
public static void encodeBoolean(Document aDocument, Element aRoot, Boolean aBoolean, String aNS, String aTagName) throws EPPEncodeException Encode aBooleanin XML with a given XML namespace and tag name. If aBoolean isnullan element is not added.- Parameters:
aDocument- DOM Document ofaRoot. 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-Booleanto 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".- Throws:
EPPEncodeException- Error encoding theBoolean.
-
encodeBooleanAttr
Encodes a booleanElementattribute value. The attribute is set to "1" with a value oftrueand is set to "0" with a value offalse.- Parameters:
aElement- Element to add attribute toaAttr- Attribute nameaVal- Attribute boolean value
-
encodeComp
public static void encodeComp(Document aDocument, Element aRoot, EPPCodecComponent aComp) throws EPPEncodeException Encode aEPPCodecComponentinstance in XML. The component is first checked for not beingnull, than it will be appended as a child ofaRoot.- Parameters:
aDocument- DOM Document ofaRoot. 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'sto add.- Throws:
EPPEncodeException- Error encodingEPPCodecComponent.
-
encodeCompList
public static void encodeCompList(Document aDocument, Element aRoot, List aList) throws EPPEncodeException Encode aListofEPPCodecComponent's in XML. EachaListelement will be encoded and added toaRoot.- Parameters:
aDocument- DOM Document ofaRoot. 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-ListofEPPCodecComponent'sto add.- Throws:
EPPEncodeException- Error encoding theListofEPPCodecComponent's.
-
encodeCompVector
public static void encodeCompVector(Document aDocument, Element aRoot, Vector aVector) throws EPPEncodeException Encode aVectorofEPPCodecComponent's in XML. EachaVectorelement will be encoded and added toaRoot.- Parameters:
aDocument- DOM Document ofaRoot. 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-VectorofEPPCodecComponent'sto add.- Throws:
EPPEncodeException- Error encoding theVectorofEPPCodecComponent's.
-
encodeDate
Encode a Java Date into an XML Schema date data type string.- Parameters:
aDate- Java Date to encode into a XML Schema date data type string.- Returns:
- Encoded XML Schema date data type string.
-
encodeDate
public static void encodeDate(Document aDocument, Element aRoot, Date aDate, String aNS, String aTagName) throws EPPEncodeException Encode aDatein XML with a given XML namespace and tag name. The format used for encoding the date is defined by the constantEPPUtil.DATE_FORMAT.- Parameters:
aDocument- DOM Document ofaRoot. 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-Dateto 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".- Throws:
EPPEncodeException- Error encodingDate.
-
encodeList
public static void encodeList(Document aDocument, Element aRoot, List aList, String aNS, String aTagName) throws EPPEncodeException Encode aListofString's in XML with a given XML namespace and tag name.- Parameters:
aDocument- DOM Document ofaRoot. 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-ListofString'sto 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".- Throws:
EPPEncodeException- Error encoding theListofString's.
-
encodeNill
public static void encodeNill(Document aDocument, Element aRoot, String aNS, String aTagName) throws EPPEncodeException DOCUMENT ME!- Parameters:
aDocument- DOCUMENT ME!aRoot- DOCUMENT ME!aNS- DOCUMENT ME!aTagName- DOCUMENT ME!- Throws:
EPPEncodeException- DOCUMENT ME!
-
encodeString
public static void encodeString(Document aDocument, Element aRoot, String aString, String aNS, String aTagName) throws EPPEncodeException Encode aStringin XML with a given XML namespace and tag name.- Parameters:
aDocument- DOM Document ofaRoot. 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-Stringto 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".- Throws:
EPPEncodeException- Error encoding theString.
-
encodeInteger
public static void encodeInteger(Document aDocument, Element aRoot, Integer aInteger, String aNS, String aTagName) throws EPPEncodeException Encode aIntegerin XML with a given XML namespace and tag name. If theIntegerisnullnothing will be encoded.- Parameters:
aDocument- DOM Document ofaRoot. 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-Integerto 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".- Throws:
EPPEncodeException- Error encoding theInteger.
-
encodeStringList
-
encodeTimeInstant
Encode a Java Date into an XML Schema timeInstant data type string. The XML Schema timeInstant data type string has the following format: CCYY-MM-DDThh:mm:ss.ssss can be followed by a Z to indicate Coordinated Universal Time- Parameters:
aDate- Java Date to encode into a XML Schema timeInstant data type string.- Returns:
- Encoded XML Schema timeInstant data type string.
-
encodeTimeInstant
public static void encodeTimeInstant(Document aDocument, Element aRoot, Date aDate, String aNS, String aTagName) throws EPPEncodeException Encode aDate, 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 constantEPPUtil.TIME_INSTANT_FORMAT.- Parameters:
aDocument- DOM Document ofaRoot. 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-Dateas 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".- Throws:
EPPEncodeException- Error encodingDate.
-
encodeVector
public static void encodeVector(Document aDocument, Element aRoot, Vector aVector, String aNS, String aTagName) throws EPPEncodeException Encode aVectorofString's in XML with a given XML namespace and tag name.- Parameters:
aDocument- DOM Document ofaRoot. 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-VectorofString'sto 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".- Throws:
EPPEncodeException- Error encoding theVectorofString's.
-
equalLists
compares twoListinstances. The Java 1.1Listclass does not implement theequalsmethods, soequalListswas written to implementequalsof twoLists(aV1 and aV2). This method is not need for Java 2.- Parameters:
aV1- First List instance to compare.aV2- Second List instance to compare.- Returns:
trueif List's are equal;falseotherwise.
-
equalVectors
compares twoVectorinstances. The Java 1.1Vectorclass does not implement theequalsmethods, soequalVectorswas written to implementequalsof twoVectors(aV1 and aV2). This method is not need for Java 2.- Parameters:
aV1- First Vector instance to compare.aV2- Second Vector instance to compare.- Returns:
trueif Vector's are equal;falseotherwise.
-
getElementByTagNameNS
Gets the first direct child element with a given tag name and XML namespace.- Parameters:
aElement- Root element to start from to search for the elementaNS- XML namespace of the elements. For example, for domain element this is "urn:iana:xmlns:domain".aTagName- Tag name to scan for.- Returns:
- Matching
Elementif found;nullotherwise.
-
getElementsByTagNameNS
Gets all of the direct child element with a given tag name and XML namespace.- Parameters:
aElement- Root element to start from to search for the elementaNS- XML namespace of the elements. For example, for domain element this is "urn:iana:xmlns:domain".aTagName- Tag name to scan for.- Returns:
VectorofNodeinstances that are elements and have the specified tag name and XML namespace.
-
getLocalName
Gets the local name given the qualified element name. If the local name is passed, it will be simply returned back.- Parameters:
aQualifiedName- Qualified name of the element likedomain:name. A localhost likenamecan be passed without error.- Returns:
- Localname of the qualified name
-
getPrefix
Gets the namespace prefix given a qualified name. If no prefix is found, empty string is returned.- Parameters:
aQualifiedName- Qualified name of the element likedomain:name.- Returns:
- Namespace prefix of the qualified name if found; empty string ("") if not found.
-
getFirstElementChild
Gets the first DOM Element Node of theaElementDOM Element.- Parameters:
aElement- Element to scan for the first element.- Returns:
- Found DOM Element Node if found;
nullotherwise.
-
getNextElementSibling
Gets the next sibling Element of a provided Element.- Parameters:
aElement- Element to start scan for the next Element.- Returns:
- Found DOM Element Node if found;
nullotherwise.
-
getTextContent
A pass-thru to the getTextContent() method using a default value of false for the required flag.- Parameters:
node- Node to get the text node from.- Returns:
- The text node
Stringvalue if found; throwingEPPDecodeExceptionotherwise. - Throws:
EPPDecodeException- Error getting text node
-
getTextContent
Return the text data within an XML tag.
<id>12345</id> yields the String "12345"
If the node==null, child==null, value==null, or value=="" => Exception
UNLESS allowEmpty, in which case return ""For reference:
<tag></tag> => child is null
<tag/> => child is null
<tag> </tag> => value is empty- Parameters:
node- Node to get the text node from.allowEmpty- Allow empty text node return value. Iftruethen if the text node is not found, the empty string will be returned instead of throwing theEPPDecodeException.- Returns:
- The text node
Stringvalue if found; empty string ifallowEmptyistrueandEPPDecodeExceptionifallowEmptyisfalseotherwise. - Throws:
EPPDecodeException- Error getting text node
-
listSubset
Determines if oneListis a subset of anotherList. If every element inaV1is inaV2returntrue; otherwise returnfalse.- Parameters:
aV1- SubsetListto compare againstaV2aV2- SupersetListto compare againstaV1- Returns:
trueifaV1is a subset ofaV2;falseotherwise.
-
toString
Converts anEPPCodecComponentto aStringfor printing. EachEPPCodecComponentcan use this utility method to implementObject.toString().- Parameters:
aComponent- a concreteEPPCodecComponentinstance- Returns:
Stringrepresentation ofEPPCodecComponentif successful; "ERROR"Stringotherwise.
-
toString
Converts anaElementto aStringfor printing.- Parameters:
aElement-Elementto print- Returns:
Stringrepresentation ofElementif successful; "ERROR"Stringotherwise.
-
toStringNoIndent
Converts anaElementto aStringfor printing without pretty printing.- Parameters:
aElement-Elementto print- Returns:
Stringrepresentation ofElementif successful; "ERROR"Stringotherwise.
-
vectorSubset
Determines if oneVectoris a subset of anotherVector. If every element inaV1is inaV2returntrue; otherwise returnfalse.- Parameters:
aV1- SubsetVectorto compare againstaV2aV2- SupersetVectorto compare againstaV1- Returns:
trueifaV1is a subset ofaV2;falseotherwise.
-
decodeIntegerList
public static List decodeIntegerList(Element aElement, String aNS, String aTagName) throws EPPDecodeException Decode aListofInteger's by XML namespace and tag name, from an XML Element. The children elements ofaElementwill be searched for the specifiedaNSnamespace URI and the specifiedaTagName. Each XML element found will be decoded and added to the returnedList. Empty child elements, will result in anEPPDecodeException.- Parameters:
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".- Returns:
ListofIntegerelements representing the text nodes of the found XML elements.- Throws:
EPPDecodeException- Error decodingaElement.
-
encodeIntegerList
public static void encodeIntegerList(Document aDocument, Element aRoot, List aList, String aNS, String aTagName) throws EPPEncodeException Encode aListofInteger's in XML with a given XML namespace and tag name.- Parameters:
aDocument- DOM Document ofaRoot. 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-ListofInteger'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".- Throws:
EPPEncodeException- Error encoding theListofInteger's.
-
collapseWhitespace
Collapse Whitespace, which means that all leading and trailing whitespace will be stripped, and all internal whitespace collapsed to single space characters. Intended to emulate XML Schema whitespace (collapse) constraining facet: http://www.w3.org/TR/xmlschema-2/#rf-whiteSpace- Parameters:
inString-Stringto be collapsed- Returns:
Stringwith whitespace collapsed, or null when result is empty
-
removeWhitespace
Remove Whitespace, which means that all whitespace will be stripped.- Parameters:
inString-Stringfrom which to remove whitespace- Returns:
Stringwith whitespace removed, or null when result is empty
-
encodeBase64
Base64 encode the XMLElementtree.- Parameters:
aElement- Root element to encode in Base64- Returns:
- Base64 encoded value of the XML
Elementtree. - Throws:
Exception- Error encoding theElement
-
findDuplicateExtNamespaces
Find the set of duplicate EPP extensions based on the list of EPP extensions.- Parameters:
aExtensions- List of EPP extensions to find duplicates- Returns:
Setof duplicate EPP extension XML namespaces;nullotherwise.
-
findUnsupportedExtNamespaces
public static Set<String> findUnsupportedExtNamespaces(List<String> aSupportedExtNamespaces, List<EPPCodecComponent> aExtensions) Find the set of unsupported EPP extensions based on passing the list of supported extension XML namespaces and the list of EPP extensions.- Parameters:
aSupportedExtNamespaces- List of supported EPP extension XML namespaces. Passnullfor no supported extensions.aExtensions- List of EPP extensions to scan for unsupported XML namespaces- Returns:
Setof unsupported EPP extension XML namespaces;nullotherwise.
-
findUnsupportedExtNamespaceSuffixes
public static Set<String> findUnsupportedExtNamespaceSuffixes(List<String> aSupportedExtNamespaceSuffixes, List<EPPCodecComponent> aExtensions) Find the set of unsupported EPP extensions based on passing the list of supported extension XML namespace suffixes and the list of EPP extensions. SeenamespaceToNamespaceSuffix(String)for conversion of an XML namespace to an XML namespace suffix.- Parameters:
aSupportedExtNamespaceSuffixes- List of supported EPP extension XML namespace suffixes. Passnullfor no supported extensions.aExtensions- List of EPP extensions to scan for unsupported XML namespace suffixes- Returns:
Setof unsupported EPP extension XML namespace suffixes;nullotherwise.
-
findExtNamespaces
public static Set<String> findExtNamespaces(List<EPPCodecComponent> aExtensions, List<String> aFilterExtNamespaces) Find the set of unique EPP extension XML namespaces based on the list of EPP extensions and the optional use of a list of XML namespaces to filter.- Parameters:
aExtensions- List of EPP extension to find unique EPP extension XML namespaces.aFilterExtNamespaces- Filter extension XML namespaces from the returned set. Set tonullfor no filtering.- Returns:
Setof unique EPP extension XML namespaces.
-
findExtNamespaceSuffixes
public static Set<String> findExtNamespaceSuffixes(List<EPPCodecComponent> aExtensions, List<String> aFilterExtNamespaceSuffixes) Find the set of unique EPP extension XML namespace suffixes based on the list of EPP extensions and the optional use of a list of XML namespace suffixes to filter. An XML namespace suffix is the last element of an XML namespace is "secDNS-1.1" for the XML namespace "urn:ietf:params:xml:ns:secDNS-1.1" or "sync-1.0" for "http://www.verisign.com/epp/sync-1.0".
Only two forms of XML namespaces is supported:- IANA XML namespace - Uses ':' as a separator
- URL namespace - Uses a uRL with "/" for the path separator
Any unsupported XML namespaces will be returned unmodified.- Parameters:
aExtensions- List of EPP extensions to find unique EPP extension XML namespace suffixes.aFilterExtNamespaceSuffixes- Filter extension XML namespace suffixes from the returned set. Set tonullfor no filtering.- Returns:
Setof unique EPP extension XML namespace suffixes.
-
namespaceToNamespaceSuffix
Convert an XML namespace to an XML namespace suffix. An XML namespace suffix is the last element of an XML namespace is "secDNS-1.1" for the XML namespace "urn:ietf:params:xml:ns:secDNS-1.1" or "sync-1.0" for "http://www.verisign.com/epp/sync-1.0".
Only two forms of XML namespaces is supported:- IANA XML namespace - Uses ':' as a separator
- URL namespace - Uses a uRL with "/" for the path separator
An unsupported XML namespace will be returned unmodified.- Parameters:
aNamespace- XML namespace to convert to an XML namespace suffix.- Returns:
- XML namespace suffix if format is supported; unmodified XML namespace otherwise.
-
namespaceToNamespaceSuffixBasename
Convert an XML namespace to an XML namespace suffix baseename. An XML namespace suffix is the last element of an XML namespace is "secDNS-1.1" for the XML namespace "urn:ietf:params:xml:ns:secDNS-1.1" or "sync-1.0" for "http://www.verisign.com/epp/sync-1.0". The namespace suffix basename removes the version from the namespace suffix, so "secDNS-1.1" becomes "secDNS" and "sync-1.0" becomes "sync".
Only two forms of XML namespaces is supported:- IANA XML namespace - Uses ':' as a separator
- URL namespace - Uses a uRL with "/" for the path separator
An unsupported XML namespace or namespace suffix will be returned unmodified.- Parameters:
aNamespace- XML namespace to convert to an XML namespace suffix basename.- Returns:
- XML namespace suffix basename if format is supported; unmodified XML namespace otherwise.
-