PsiLanguageInjectionHost (@NotNull String text) { try { final String quoteChar = getTextLength() > 0 ? getText().substring(0, 1) : ""; String contents = StringUtil.containsAnyChar(quoteChar, "'\"") ? StringUtil.trimEnd(StringUtil.trimStart(text, quoteChar), quoteChar) : text; XmlAttribute newAttribute = XmlElementFactory.getInstance(getProject()).createAttribute( StringUtil.defaultIfEmpty((getParent() instanceof XmlAttribute) ? ((XmlAttribute)getParent()).getName() : null, "q"), contents, this); XmlAttributeValue newValue = newAttribute.getValueElement(); CheckUtil.checkWritable(this); replaceAllChildrenToChildrenOf(newValue.getNode()); } catch (IncorrectOperationException e) { LOG.error(e); } return this; }