How can I use createChildTag to create a child tag without adding xmlns=""

When I use this code:

PsiElement e = xmlTag.createChildTag("e", "", "blah", x).copy();

The generated code looks something like this:


How can I get rid of the xmlns attribute?


1 comment
Comment actions Permalink

Try using the namespace of parent element just like this:

xmlTag.createChildTag("e", xmlTag.getNamespace(), "blah", true);

But I'm not sure about value of last (boolean) parameter - I set it true for non-leaf elements and false for empty elements (or am I doing it wrong?).

Josef Pavlas


Please sign in to leave a comment.