We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ae46c57 commit a5f8ed7Copy full SHA for a5f8ed7
stagpy/xdmf.py
@@ -7,6 +7,10 @@
7
from xml.etree import ElementTree as ET
8
9
10
+class EndOfXml(Exception):
11
+ """End of Xml has been reached."""
12
+
13
14
class XmlStream:
15
def __init__(self, filepath: Path):
16
self.filepath = filepath
@@ -22,7 +26,7 @@ def _to_next_start(self) -> ET.Element:
22
26
if self._event == "start":
23
27
return self._elem
24
28
self._elem.clear()
25
- raise RuntimeError("Reached end of file")
29
+ raise EndOfXml("Reached end of file")
30
31
@property
32
def current(self) -> ET.Element:
@@ -46,7 +50,7 @@ def iter_tag(self, tag: str) -> Iterator[None]:
46
50
while True:
47
51
self.skip_to_tag(tag)
48
52
yield None
49
- except RuntimeError:
53
+ except EndOfXml:
54
pass
55
56
def drop(self) -> None:
0 commit comments