public void setAttribute( final String namespace, final String name, final Object value, final boolean notifyChange) { if (copyOnWrite) { this.attributes = attributes.clone(); this.copyOnWrite = false; } final Object oldValue = attributes.setAttribute(namespace, name, value); if (cachedAttributes != null) { if (cachedAttributes.getChangeTracker() != attributes.getChangeTracker()) { cachedAttributes = null; } } if (AttributeNames.Core.NAMESPACE.equals(namespace) && AttributeNames.Core.ELEMENT_TYPE.equals(name)) { if (value instanceof ElementType) { this.elementType = (ElementType) value; } else { this.elementType = LegacyType.INSTANCE; } } if (notifyChange) { notifyNodePropertiesChanged(new AttributeChange(namespace, name, oldValue, value)); } }