/** * Adds a node to the map. */ public Node setNamedItem( String ns, String name, Node arg ) throws DOMException { if ( ns != null && ns.length() == 0 ) { ns = null; } ( (AbstractAttr)arg ).setOwnerElement( AbstractElement.this ); AbstractAttr result = (AbstractAttr)put( ns, name, arg ); if ( result != null ) { result.setOwnerElement( null ); fireDOMAttrModifiedEvent( name, result, result.getNodeValue(), "", MutationEvent.REMOVAL ); } fireDOMAttrModifiedEvent( name, (Attr)arg, "", arg.getNodeValue(), MutationEvent.ADDITION ); return result; }
/** * Adds a node to the map. */ public Node setNamedItem( String ns, String name, Node arg ) throws DOMException { if ( ns != null && ns.length() == 0 ) { ns = null; } ( (AbstractAttr)arg ).setOwnerElement( AbstractElement.this ); AbstractAttr result = (AbstractAttr)put( ns, name, arg ); if ( result != null ) { result.setOwnerElement( null ); fireDOMAttrModifiedEvent( name, result, result.getNodeValue(), "", MutationEvent.REMOVAL ); } fireDOMAttrModifiedEvent( name, (Attr)arg, "", arg.getNodeValue(), MutationEvent.ADDITION ); return result; }
/** * Adds a node to the map. */ public Node setNamedItem( String ns, String name, Node arg ) throws DOMException { if ( ns != null && ns.length() == 0 ) { ns = null; } ( (AbstractAttr)arg ).setOwnerElement( AbstractElement.this ); AbstractAttr result = (AbstractAttr)put( ns, name, arg ); if ( result != null ) { result.setOwnerElement( null ); fireDOMAttrModifiedEvent( name, result, result.getNodeValue(), "", MutationEvent.REMOVAL ); } fireDOMAttrModifiedEvent( name, (Attr)arg, "", arg.getNodeValue(), MutationEvent.ADDITION ); return result; }
public void fireDOMAttrModifiedEvent(String name, Attr node, String oldv, String newv, short change) { super.fireDOMAttrModifiedEvent(name, node, oldv, newv, change); // This handles the SVG 1.2 behaviour where setting the value of // 'id' must also change 'xml:id', and vice versa. if (((SVGOMDocument) ownerDocument).isSVG12 && (change == MutationEvent.ADDITION || change == MutationEvent.MODIFICATION)) { if (node.getNamespaceURI() == null && node.getNodeName().equals(SVG_ID_ATTRIBUTE)) { Attr a = getAttributeNodeNS(XML_NAMESPACE_URI, SVG_ID_ATTRIBUTE); if (a == null) { setAttributeNS(XML_NAMESPACE_URI, XML_ID_QNAME, newv); } else if (!a.getNodeValue().equals(newv)) { a.setNodeValue(newv); } } else if (node.getNodeName().equals(XML_ID_QNAME)) { Attr a = getAttributeNodeNS(null, SVG_ID_ATTRIBUTE); if (a == null) { setAttributeNS(null, SVG_ID_ATTRIBUTE, newv); } else if (!a.getNodeValue().equals(newv)) { a.setNodeValue(newv); } } } }
public void fireDOMAttrModifiedEvent(String name, Attr node, String oldv, String newv, short change) { super.fireDOMAttrModifiedEvent(name, node, oldv, newv, change); // This handles the SVG 1.2 behaviour where setting the value of // 'id' must also change 'xml:id', and vice versa. if (((SVGOMDocument) ownerDocument).isSVG12 && (change == MutationEvent.ADDITION || change == MutationEvent.MODIFICATION)) { if (node.getNamespaceURI() == null && node.getNodeName().equals(SVG_ID_ATTRIBUTE)) { Attr a = getAttributeNodeNS(XML_NAMESPACE_URI, SVG_ID_ATTRIBUTE); if (a == null) { setAttributeNS(XML_NAMESPACE_URI, XML_ID_QNAME, newv); } else if (!a.getNodeValue().equals(newv)) { a.setNodeValue(newv); } } else if (node.getNodeName().equals(XML_ID_QNAME)) { Attr a = getAttributeNodeNS(null, SVG_ID_ATTRIBUTE); if (a == null) { setAttributeNS(null, SVG_ID_ATTRIBUTE, newv); } else if (!a.getNodeValue().equals(newv)) { a.setNodeValue(newv); } } } }
public void fireDOMAttrModifiedEvent(String name, Attr node, String oldv, String newv, short change) { super.fireDOMAttrModifiedEvent(name, node, oldv, newv, change); // This handles the SVG 1.2 behaviour where setting the value of // 'id' must also change 'xml:id', and vice versa. if (((SVGOMDocument) ownerDocument).isSVG12 && (change == MutationEvent.ADDITION || change == MutationEvent.MODIFICATION)) { if (node.getNamespaceURI() == null && node.getNodeName().equals(SVG_ID_ATTRIBUTE)) { Attr a = getAttributeNodeNS(XML_NAMESPACE_URI, SVG_ID_ATTRIBUTE); if (a == null) { setAttributeNS(XML_NAMESPACE_URI, XML_ID_QNAME, newv); } else if (!a.getNodeValue().equals(newv)) { a.setNodeValue(newv); } } else if (node.getNodeName().equals(XML_ID_QNAME)) { Attr a = getAttributeNodeNS(null, SVG_ID_ATTRIBUTE); if (a == null) { setAttributeNS(null, SVG_ID_ATTRIBUTE, newv); } else if (!a.getNodeValue().equals(newv)) { a.setNodeValue(newv); } } } }
/** * <b>DOM</b>: Implements {@link org.w3c.dom.Node#setNodeValue(String)}. */ public void setNodeValue(String nodeValue) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] { new Integer(getNodeType()), getNodeName() }); } String s = getNodeValue(); // Remove all the children Node n; while ((n = getFirstChild()) != null) { removeChild(n); } String val = (nodeValue == null) ? "" : nodeValue; // Create and append a new child. n = getOwnerDocument().createTextNode(val); appendChild(n); if (ownerElement != null) { ownerElement.fireDOMAttrModifiedEvent(nodeName, this, s, val, MutationEvent.MODIFICATION); } }
fireDOMAttrModifiedEvent( n.getNodeName(), n, n.getNodeValue(), "", MutationEvent.REMOVAL ); return n;
fireDOMAttrModifiedEvent( n.getNodeName(), n, n.getNodeValue(), "", MutationEvent.REMOVAL ); return n;
fireDOMAttrModifiedEvent( n.getNodeName(), n, n.getNodeValue(), "", MutationEvent.REMOVAL ); return n;
/** * <b>DOM</b>: Implements {@link org.w3c.dom.Node#setNodeValue(String)}. */ public void setNodeValue(String nodeValue) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] {(int) getNodeType(), getNodeName() }); } String s = getNodeValue(); // Remove all the children Node n; while ((n = getFirstChild()) != null) { removeChild(n); } String val = (nodeValue == null) ? "" : nodeValue; // Create and append a new child. n = getOwnerDocument().createTextNode(val); appendChild(n); if (ownerElement != null) { ownerElement.fireDOMAttrModifiedEvent(nodeName, this, s, val, MutationEvent.MODIFICATION); } }
/** * <b>DOM</b>: Implements {@link org.w3c.dom.Node#setNodeValue(String)}. */ public void setNodeValue(String nodeValue) throws DOMException { if (isReadonly()) { throw createDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node", new Object[] {(int) getNodeType(), getNodeName() }); } String s = getNodeValue(); // Remove all the children Node n; while ((n = getFirstChild()) != null) { removeChild(n); } String val = (nodeValue == null) ? "" : nodeValue; // Create and append a new child. n = getOwnerDocument().createTextNode(val); appendChild(n); if (ownerElement != null) { ownerElement.fireDOMAttrModifiedEvent(nodeName, this, s, val, MutationEvent.MODIFICATION); } }