Do you mean you want to get a reference to the currently selected insertion point?
myIP = app.selection;
does that for you, but it works only if there is indeed a selected insertion point.
If you want to check that it is an insertion point, then first you need to check that there is even a selection at all. And, there can't be a selection unless there is a document. So:
if (app.documents.length > 0 &&
app.selection.length === 1 &&
// there is a selection and it is text, so:
myIP = app.selection.insertionPoints;
Processing instructions are less-known citizens of the XML world.
The following snippet takes an arbitrary XML element - the document root - and adds a processing instruction.
A short look at the ESTK data browser shows that this processing instruction has an associated insertion point named "storyOffset".
var root = app.activeDocument.xmlElements.item(0);
var myPI = root.xmlInstructions.add("target","data");
Now I can make sense of the question!
Let me explain breifly.
My sample Xml.
<B>boy <?Addinfo <BInfo>Good Boy</BInfo>?> </B>
If you check in the Element B, there is a processing insturction Called Addinfo. I want to get that PI insertionpoint.
We can get its parent insp which is element B. But how to get its PI Addinfo Insp.
Can we get the PageNo using PI's StoryOffset.