/** * NON-DOM: a factory method used by the Xerces DOM parser * to create an element. * * @param namespaceURI The namespace URI of the attribute to * create. When it is null or an empty string, * this method behaves like createAttribute. * @param qualifiedName The qualified name of the attribute to * instantiate. * @param localpart The local name of the attribute to instantiate. * * @return Attr A new Attr object. * @throws DOMException INVALID_CHARACTER_ERR: Raised if the specified * name contains an invalid character. */ public Attr createAttributeNS(String namespaceURI, String qualifiedName, String localpart) throws DOMException { return new AttrNSImpl(this, namespaceURI, qualifiedName, localpart); }
void rename(String namespaceURI, String qualifiedName) { if (needsSyncData()) { synchronizeData(); } this.name = qualifiedName; setName(namespaceURI, qualifiedName); }
@Override public void setValue(String value) { super.setValue(value); // XXX #105085 Not storing the cached node, and forcing it to recreate each time. textNode = null; } } // End of FixAttrNSImpl.
/** * Introduced in DOM Level 2. <p> * * Returns the local part of the qualified name of this node. * @since WD-DOM-Level-2-19990923 */ public String getLocalName() { if (needsSyncData()) { synchronizeData(); } return localName; }
throws DOMException if (needsSyncData()) { synchronizeData(); if (ownerDocument().errorChecking) { if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); if (!CoreDocumentImpl.isXMLName(prefix,ownerDocument().isXML11Version())) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null); throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
((AttrNSImpl) at).rename(namespaceURI, name); while (child != null) { at.removeChild(child); nat.appendChild(child); child = at.getFirstChild();
/** * DOM2: Constructor for Namespace implementation. */ protected AttrNSImpl(CoreDocumentImpl ownerDocument, String namespaceURI, String qualifiedName) { super(ownerDocument, qualifiedName); setName(namespaceURI, qualifiedName); }
private void setName(String namespaceURI, String qname){ CoreDocumentImpl ownerDocument = ownerDocument(); String prefix;
/** * Introduced in DOM Level 2. <p> * * The namespace URI of this node, or null if it is unspecified.<p> * * This is not a computed value that is the result of a namespace lookup * based on an examination of the namespace declarations in scope. It is * merely the namespace URI given at creation time.<p> * * For nodes created with a DOM Level 1 method, such as createElement * from the Document interface, this is null. * @since WD-DOM-Level-2-19990923 */ public String getNamespaceURI() { if (needsSyncData()) { synchronizeData(); } // REVIST: This code could/should be done at a lower-level, such that // the namespaceURI is set properly upon creation. However, there still // seems to be some DOM spec interpretation grey-area. return namespaceURI; }
/** * Introduced in DOM Level 2. <p> * * The namespace prefix of this node, or null if it is unspecified. <p> * * For nodes created with a DOM Level 1 method, such as createElement * from the Document interface, this is null. <p> * * @since WD-DOM-Level-2-19990923 */ public String getPrefix() { if (needsSyncData()) { synchronizeData(); } int index = name.indexOf(':'); return index < 0 ? null : name.substring(0, index); }
/** * Introduced in DOM Level 2. <p> * Creates an attribute of the given qualified name and namespace URI. * If the given namespaceURI is null or an empty string and the * qualifiedName has a prefix that is "xml", the created element * is bound to the predefined namespace * "http://www.w3.org/XML/1998/namespace" [Namespaces]. * * @param namespaceURI The namespace URI of the attribute to * create. When it is null or an empty string, * this method behaves like createAttribute. * @param qualifiedName The qualified name of the attribute to * instantiate. * @return Attr A new Attr object. * @throws DOMException INVALID_CHARACTER_ERR: Raised if the specified * name contains an invalid character. * @since WD-DOM-Level-2-19990923 */ public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException { return new AttrNSImpl(this, namespaceURI, qualifiedName); }