doc.insertChild(c1, 0);
grandparent.insertChild(c2, 0);
parent.insertChild(c3, 0);
child.insertChild(c4, 0);
ProcessingInstruction pi = new ProcessingInstruction("appendix", "text");
doc.appendChild(pi);
ProcessingInstruction pi2 = new ProcessingInstruction("test", "text");
parent.appendChild(pi2);
Nodes result = doc.query("descendant::processing-instruction('test')");
assertEquals(1, result.size());