/** * Helper to modify the tag name in sub-classes */ private static void setTagName(Element element, String tagName) { if (element == null || tagName == null) return; ((ElementImpl) element).setTagName(tagName); }
protected void setTagName(String tagName) { super.setTagName(tagName); }
/** */ public void setPrefix(String prefix) throws DOMException { IDOMNode parent = (IDOMNode) getParentNode(); if (parent != null && !parent.isChildEditable()) { throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, new String()); } int prefixLength = (prefix != null ? prefix.length() : 0); String localName = getLocalName(); if (prefixLength == 0) { if (localName == null || localName.length() == 0) { // invalid local name return; } setTagName(localName); } else { int localLength = (localName != null ? localName.length() : 0); StringBuffer buffer = new StringBuffer(prefixLength + 1 + localLength); buffer.append(prefix); buffer.append(':'); if (localName != null) buffer.append(localName); setTagName(buffer.toString()); } boolean changeEndTag = hasEndTag(); notifyStartTagChanged(); if (changeEndTag) notifyEndTagChanged(); }
/** * createElement method * * @return org.w3c.dom.Element * @param tagName * java.lang.String */ public Element createElement(String tagName) throws DOMException { checkTagNameValidity(tagName); ElementImpl element = new ElementImpl(); element.setOwnerDocument(this); element.setTagName(tagName); return element; }
String tagName = element.getTagName(); if (tagName == null || !tagName.equals(newTagName)) { element.setTagName(newTagName); element.notifyValueChanged();