public class XCardElement extends Object
Element object.| Modifier and Type | Class and Description |
|---|---|
static class |
XCardElement.XCardValue
Represents the data type and value of a child element under an
XCardElement. |
| Constructor and Description |
|---|
XCardElement(Element element)
Wraps an existing XML element.
|
XCardElement(Element element,
VCardVersion version)
Wraps an existing XML element.
|
| Modifier and Type | Method and Description |
|---|---|
List<String> |
all(String localName)
Gets the value of all non-empty child elements that have the given name.
|
List<String> |
all(VCardDataType dataType)
Gets all the values of a given data type.
|
List<Element> |
append(String name,
Collection<String> values)
Adds multiple child elements, each with the same name.
|
Element |
append(String name,
String value)
Adds a child element.
|
Element |
append(VCardDataType dataType,
String value)
Adds a value.
|
Document |
document()
Gets the owner document.
|
Element |
element()
Gets the wrapped XML element.
|
String |
first(String... names)
Gets the value of the first child element with one of the given names.
|
String |
first(VCardDataType... dataTypes)
Gets the first value with one of the given data types.
|
XCardElement.XCardValue |
firstValue()
Finds the first child element that has the xCard namespace and returns
its data type and value.
|
VCardVersion |
version()
Gets the vCard version.
|
public XCardElement(Element element)
element - the XML elementpublic XCardElement(Element element, VCardVersion version)
element - the XML elementversion - the vCard versionpublic String first(VCardDataType... dataTypes)
dataTypes - the data type(s) to look for (null signifies the
"unknown" data type)public String first(String... names)
names - the possible names of the elementpublic List<String> all(VCardDataType dataType)
dataType - the data type to look forpublic List<String> all(String localName)
localName - the element namepublic Element append(VCardDataType dataType, String value)
dataType - the data type or null for the "unknown" data typevalue - the valuepublic Element append(String name, String value)
name - the name of the child elementvalue - the value of the child element.public List<Element> append(String name, Collection<String> values)
name - the name for all the child elementsvalues - the values of each child elementpublic VCardVersion version()
public XCardElement.XCardValue firstValue()
XCardElement's text content, along with a null data type, is
returned.Copyright © 2012–2023 Michael Angstadt. All rights reserved.