icalendar.parser.xcal.component module#
A parser for components.
- class icalendar.parser.xcal.component.XCalComponentParser(element, component_factory, types_factory)[source]#
Bases:
XCalParserA parser for components.
- Parameters:
component_factory (
ComponentFactory) – The component factory to use.element (
Element|ElementAdapter) – The element to parse.types_factory (
TypesFactory) – The types factory to use.
Examples
The
elementcan be a anicalendarstream that contains one or morevcalendarcomponents.<icalendar xmlns="urn:ietf:params:xml:ns:icalendar-2.0"> <vcalendar> ... </vcalendar> </icalendar>
Components can contain other components inside the
componentstag. The parameterelementcan be such acomponentstag.<components> <vevent> ... </vevent> </components>
- parse_component()[source]#
Convert one child into a
Component.- Return type:
- Returns:
The parsed component.
- Raises:
XCalParsingError – If there is an error in the child.
InvalidParserState – If all components have been parsed or a property value type did not parse anything.
Example
The XML below shows the structure of one component element that gets parsed by this method.
vcalendaris the name of the component. Each component can contain apropertiesand acomponentselement with more components.<vcalendar> <properties> ... </properties> <components> <vevent> ... </vevent> </components> </vcalendar>
- parse_component_from_child()[source]#
Parse a component from a child element.
- Return type:
- Returns:
The parsed component.
- Raises:
XCalParsingError – If there is an error in the child.
InvalidParserState – If all components have been parsed or a property value type did not parse anything.