String (XmlProcessingInstruction pi) { final PsiElement[] children = pi.getChildren(); LOG.assertTrue(children[1] instanceof XmlToken && ((XmlToken)children[1]).getTokenType() == XmlTokenType.XML_NAME, "Unknown PI structure"); String text = children[1].getText(); int i; for (i=0; i<text.length() && text.charAt(i) == ' ';) i++; // skip final int pos = text.indexOf(' ', i); if (pos != -1) { text = text.substring(i, pos); } else { text = text.substring(i); } return text; }