+ if len(root_elem) < 1 or root_elem[0].tag != SSTNS('metadata'):
+ raise ValueError("The first tag in section should be metadata")
+ if len(root_elem) < 2 or root_elem[1].tag != SSTNS('header'):
+ raise ValueError("The first tag after metadata should be header")
+ header = root_elem[1]
+ if not getattr(header, 'text', None) or not header.text.strip():
+ raise ValueError(
+ "The first header should contain the title in plain text (no links, emphasis etc.) and cannot be empty")