AttributeImpl implements Attribute { protected AttributeImpl(String namespaceURI, String prefix, String name, String value) { Assert.notNull(namespaceURI, "namespaceURI"); Assert.notNull(name, "name"); Assert.notNull(value, "value"); if ((prefix != null) && (prefix.length() == 0)) { prefix = null; } if ((prefix != null) && !XMLChar.isValidNCName(prefix)) { String msg = MessageFormat.format( "''{0}'' is not a valid XML prefix", prefix); throw new IllegalArgumentException(msg); } if (!XMLChar.isValidName(name)) { String msg = MessageFormat.format( "''{0}'' is not a valid attribute name", name); throw new IllegalArgumentException(msg); } Assert.validXMLChars(value, "value"); this.namespaceURI = namespaceURI; this.prefix = prefix; this.name = name; this.value = value; } protected  AttributeImpl(String namespaceURI, String prefix, String name,
			String value); String getNamespaceUri(); String getPrefix(); String getName(); String getValue(); void setOwner(Element owner); Element getOwnerElement(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); Object clone();  }
@Test public void testAttributeImpl() { new ConcreteAttributeImpl("ns", "pre", "name", "value"); new ConcreteAttributeImpl("ns", "", "name", "value"); new ConcreteAttributeImpl("ns", null, "name", "value"); try { new ConcreteAttributeImpl(null, "pre", "name", "value"); fail("Expected NullPointerException"); } catch (NullPointerException e) { } try { new ConcreteAttributeImpl("ns", "pre", null, "value"); fail("Expected NullPointerException"); } catch (NullPointerException e) { } try { new ConcreteAttributeImpl("ns", "pre", "name", null); fail("Expected NullPointerException"); } catch (NullPointerException e) { } try { new ConcreteAttributeImpl("ns", "pre:1", "name", "value"); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { } try { new ConcreteAttributeImpl("ns", "pre", "na\nme", "value"); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { } try { new ConcreteAttributeImpl("ns", "pre", "name", "val\fue"); } catch (IllegalArgumentException e) { } }