ProcessingInstruction pi = (ProcessingInstruction)piNodes.get(i);
ParentNode piParent = pi.getParent();
int index = piParent.indexOf(pi);
Element e = new Element("pi-proxy");
e.addAttribute(new Attribute("pinumber", Integer.toString(i)));
pi.detach();
piParent.insertChild(e, index);
procInstructions.add(pi);
}
}