boolean (String targetNs, XmlTag contextTag) { boolean attributeShouldBeQualified = false; String contextNs = contextTag.getNamespace(); if (!contextNs.equals(targetNs)) { final XmlElementDescriptor xmlElementDescriptor = contextTag.getDescriptor(); if (xmlElementDescriptor instanceof XmlElementDescriptorImpl elementDescriptor) { final TypeDescriptor type = elementDescriptor.getType(); if (type instanceof ComplexTypeDescriptor typeDescriptor) { if (myReferenceName != null) { return myReferenceName.indexOf(':') != 0; } XmlAttributeDescriptor[] attributes = ((ComplexTypeDescriptor)type).getAttributes(contextTag); if (ArrayUtil.contains(this, attributes)) { return false; } attributeShouldBeQualified = typeDescriptor.canContainAttribute(targetNs, null) != ComplexTypeDescriptor.CanContainAttributeType.CanNotContain; } if (!attributeShouldBeQualified && contextNs.length() == 0 && targetNs.length() > 0) { attributeShouldBeQualified = !targetNs.equals(elementDescriptor.getNamespace()); } } } return attributeShouldBeQualified; }