How to Detect "Phantom XML" Items in InDesign's XML Structure
Hello!
There is an issue I am experiencing where when a page is deleted that used to have structure somehow has one piece of the structure thinking there's still a document element attached to it.
Does anyone have advice on how to detect these items? I think maybe they all have "XMLStory" as the page-element parent at the top of it all, just thinking.

I would like to create a method that can be fed an XML element, and it needs to find its XML parents all the way to the top, and return true if the parent of the xmlContent is an instance of XMLStory.
Apparently the ones which do not have a representation in the pages are called "XMLStory", which under it has some kind of all valid elements even if they are not on the document pages.
I found some issue which may be a bug, where indeed I was getting a false positive with the parentTextFrame technique for one item and sure enough, when I visited it in the XML Structure panel, it had a "Go to Item" menu option available.
However, clicking this option just made InDesign unresponsive for a second, before in the XML Structure it underlined the nodes (this is what it does when it 'selects' an item on the page normally related to an XML node), but nothing effectively happens in the document.
So the problem as I would like to call it is "phantom XML".
I wish to ignore all these non-existing-item XML nodes, does anyone have an idea on how to accomplish this?
<Title renamed by MOD>
