Next available positive integer id value in this story XML document. The value is determined by incrementing the maximum existing id value. Gaps in the existing id sequence are not filled. The id attribute value is unique in the document, without regard to the element type i
(self)
| 75 | |
| 76 | @property |
| 77 | def next_id(self) -> int: |
| 78 | """Next available positive integer id value in this story XML document. |
| 79 | |
| 80 | The value is determined by incrementing the maximum existing id value. Gaps in |
| 81 | the existing id sequence are not filled. The id attribute value is unique in the |
| 82 | document, without regard to the element type it appears on. |
| 83 | """ |
| 84 | id_str_lst = self._element.xpath("//@id") |
| 85 | used_ids = [int(id_str) for id_str in id_str_lst if id_str.isdigit()] |
| 86 | if not used_ids: |
| 87 | return 1 |
| 88 | return max(used_ids) + 1 |
| 89 | |
| 90 | @lazyproperty |
| 91 | def _document_part(self) -> DocumentPart: |