icalendar.parser.xcal.adapter module#
- class icalendar.parser.xcal.adapter.ChildElementAdapter(child, parent, index=1)[source]#
Bases:
ElementAdapterAn adapter class with convenience methods for child elements.
- Parameters:
child (
Element) – The child element.index (
int) – The index for building the XPath in the parent.parent (
ElementAdapter) – The parent element adapter.
- property parent: ElementAdapter#
The parent element.
- class icalendar.parser.xcal.adapter.ElementAdapter(element)[source]#
Bases:
objectAn adapter class with convenience methods for XML elements.
This is a read-only access adapter. All operations on ElementAdapter are reproducible and do not change the underlying element.
- property children: list[ChildElementAdapter]#
A list of child elements.
- get_inner_text()[source]#
Return the inner text.
This is useful when there is a broken property.
- Return type:
- get_text_without_whitespace()[source]#
Return the element's text with all whitespace removed.
- Return type:
- get_xsd_float()[source]#
Return the element's text parsed as
xsd:float.- Return type:
- Returns:
The parsed float value.
- Raises:
XCalParsingError – If the value is not a float.
- get_xsd_string()[source]#
Return the element's text as
xsd:string.This is the only datatype that leaves all the whitespace.
See also
- Return type:
- get_xsd_token()[source]#
Return the element's text as
xsd:token.xsd:tokenis the most appropriate datatype to use for strings that don't care about whitespace.See also
- Return type:
- property is_extension: bool#
Whether the element is in a namespace other than the iCalendar namespace.
Elements without a namespace belong to iCalendar. Extension elements directly in
propertiesare XML properties.See also
- Returns:
Truefor an element outside the iCalendar namespace, orFalsefor an element either in the iCalendar namespace or without a namespace.
- parse_tag(tag)[source]#
Get the first child element with the given tag.
- Returns:
The first child element with the given tag.
- Raises:
XCalParsingError – If the tag is not found.