Find the existing feed node and its parent for a given XML URL. Returns: Tuple of (parent, feed_node) if found, None otherwise.
(body: ET.Element, xml_url: str)
| 316 | |
| 317 | |
| 318 | def find_existing_feed_node(body: ET.Element, xml_url: str) -> Optional[Tuple[ET.Element, ET.Element]]: |
| 319 | """Find the existing feed node and its parent for a given XML URL. |
| 320 | |
| 321 | Returns: |
| 322 | Tuple of (parent, feed_node) if found, None otherwise. |
| 323 | """ |
| 324 | wanted = normalize_url(xml_url) |
| 325 | if not wanted: |
| 326 | return None |
| 327 | for parent, rss in iter_rss_nodes(body): |
| 328 | existing = normalize_url(rss.attrib.get("xmlUrl", "")) |
| 329 | if existing == wanted: |
| 330 | return (parent, rss) |
| 331 | return None |
| 332 | |
| 333 | |
| 334 | def add_feed_to_tree( |
no test coverage detected