icalendar.parser.xcal.base module#
xCal parser class to fully parse the content.
- exception icalendar.parser.xcal.base.InvalidParserState[source]#
Bases:
ExceptionThe parser is in an invalid state.
This exception should never be raised in production code.
- class icalendar.parser.xcal.base.XCalParser(element)[source]#
Bases:
objectCreate a new XCalParser that takes care of the parsing state.
An element is passed to the parser. The element and its child elements can be inspected and marked as parsed.
- property child: ChildElementAdapter#
Get the next child element.
- Raises:
InvalidParserState – If there are no more children.
- done()[source]#
Done with this child element.
- Raises:
InvalidParserState – If there are no more children.
- property element: ElementAdapter#
The element to parse.
- ensure_tag_is_present(tag)[source]#
Check for the presence of a tag that has not yet been parsed.
This serves as a check before
parse_tag(). The returned tag is not marked as parsed.- Return type:
- Returns:
The tag that is present.
- Raises:
XCalParsingError – If the tag is not found.
- parse_optional_tag(tag)[source]#
Find a child tag and return it if present, else
None.This child is then considered parsed.
- Return type:
- parse_parameters()[source]#
Return empty parameters.
This can be changed in subclasses.
- Return type:
- parse_tag(tag=None)[source]#
Find a child tag and return it.
This child is then considered parsed.
- Return type:
- Returns:
The child element with the tag, or if no tag is given, then the first child.
- Raises:
XCalParsingError – If the tag is not found.