/** * Deeply exports this node to the given document. */ protected Node deepExport(Node n, AbstractDocument d) { super.export(n, d); ((AbstractElement)n).initializeAttributes(); super.deepExport(n, d); return n; }
/** * <b>DOM</b>: Implements {@link ElementTraversal#getFirstElementChild()}. */ public Element getFirstElementChild() { Node n = getFirstChild(); while (n != null) { if (n.getNodeType() == Node.ELEMENT_NODE) { return (Element) n; } n = n.getNextSibling(); } return null; }
/** * Checks the validity of a node to be inserted. * @param n The node to be inserted. */ protected void checkChildType(Node n, boolean replace) { switch (n.getNodeType()) { case ELEMENT_NODE: // fall-through is intended case PROCESSING_INSTRUCTION_NODE: case COMMENT_NODE: case TEXT_NODE: case CDATA_SECTION_NODE: case ENTITY_REFERENCE_NODE: case DOCUMENT_FRAGMENT_NODE: break; default: throw createDOMException (DOMException.HIERARCHY_REQUEST_ERR, "child.type", new Object[] {(int) getNodeType(), getNodeName(), (int) n.getNodeType(), n.getNodeName() }); } }
/** * <b>DOM</b>: Implements {@link * org.w3c.dom.Element#setAttribute(String,String)}. */ public void setAttribute(String name, String value) throws DOMException { if (attributes == null) { attributes = createAttributes(); } Attr attr = getAttributeNode(name); if (attr == null) { attr = getOwnerDocument().createAttribute(name); attr.setValue(value); attributes.setNamedItem(attr); } else { attr.setValue(value); } }
if (((AbstractAttr)node).isId()) ownerDocument.addIdEntry(this, newv); attrAdded(node, newv); break; if (((AbstractAttr)node).isId()) ownerDocument.updateIdEntry(this, oldv, newv); attrModified(node, oldv, newv); break; if (((AbstractAttr)node).isId()) ownerDocument.removeIdEntry(this, oldv); attrRemoved(node, oldv); AbstractDocument doc = getCurrentDocument(); if (doc.getEventsEnabled() && !oldv.equals(newv)) { DOMMutationEvent ev dispatchEvent(ev);
String type = script.getAttributeNS (null, SVGConstants.SVG_TYPE_ATTRIBUTE); try { String href = XLinkSupport.getXLinkHref(script); ParsedURL purl = new ParsedURL(script.getBaseURI(), href); ParsedURL purl = new ParsedURL(script.getBaseURI(), href); (INLINE_SCRIPT_DESCRIPTION, new Object [] {d.getURL(), "<"+script.getNodeName()+">", line}); Node n = script.getFirstChild(); if (n != null) { StringBuffer sb = new StringBuffer();
/** * Checks the validity of a node to add. */ protected void checkNode( Node arg ) { if ( isReadonly() ) { throw createDOMException ( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node.map", new Object[]{} ); } if ( getOwnerDocument() != arg.getOwnerDocument() ) { throw createDOMException( DOMException.WRONG_DOCUMENT_ERR, "node.from.wrong.document", new Object[]{(int) arg.getNodeType(), arg.getNodeName()} ); } if ( arg.getNodeType() == ATTRIBUTE_NODE && ( (Attr)arg ).getOwnerElement() != null ) { throw createDOMException( DOMException.WRONG_DOCUMENT_ERR, "inuse.attribute", new Object[]{arg.getNodeName()} ); } }
/** * <b>DOM</b>: Implements {@link * org.w3c.dom.Element#setAttributeNS(String,String,String)}. */ public void setAttributeNS(String namespaceURI, String qualifiedName, String value) throws DOMException { if (attributes == null) { attributes = createAttributes(); } if (namespaceURI != null && namespaceURI.length() == 0) { namespaceURI = null; } Attr attr = getAttributeNodeNS(namespaceURI, qualifiedName); if (attr == null) { attr = getOwnerDocument().createAttributeNS(namespaceURI, qualifiedName); attr.setValue(value); attributes.setNamedItemNS(attr); } else { attr.setValue(value); } }
if ( isReadonly() ) { throw createDOMException ( DOMException.NO_MODIFICATION_ALLOWED_ERR, "readonly.node.map", throw createDOMException( DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[]{""} ); throw createDOMException( DOMException.NOT_FOUND_ERR, "attribute.missing", new Object[]{localName} ); fireDOMAttrModifiedEvent( n.getNodeName(), n, n.getNodeValue(), "", MutationEvent.REMOVAL ); return n;
Element elt = (Element)evt.getCurrentTarget(); String script = handlerElement.getTextContent(); if (script.length() == 0) return; = (AbstractDocument) handlerElement.getOwnerDocument(); int line = dl.getLineNumber(handlerElement); final String desc = Messages.formatMessage String lang = handlerElement.getAttributeNS (null, SVGConstants.SVG_CONTENT_SCRIPT_TYPE_ATTRIBUTE); if (lang.length() == 0) {
EventSupport es2 = e.getEventSupport(); if (es2 == null) { AbstractDOMImplementation di e.eventSupport = es2; es1.moveEventListeners(e.getEventSupport()); e.appendChild(n.getFirstChild()); for (int j = 0; j < nnm.getLength(); j++) { Attr a = (Attr) nnm.item(j); e.setAttributeNodeNS(a);
/** * Exports this node to the given document. */ protected Node export(Node n, AbstractDocument d) { super.export(n, d); AbstractElementNS ae = (AbstractElementNS)n; ae.namespaceURI = namespaceURI; return n; }
/** * 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; }
if (ens != null) { String eprefix = e.getPrefix(); if (!compareStrings(ae.lookupNamespaceURI(eprefix), ens)) { e.setAttributeNS (XMLConstants.XMLNS_NAMESPACE_URI, if (ae.lookupNamespaceURI(null) == null) { e.setAttributeNS (XMLConstants.XMLNS_NAMESPACE_URI, String aprens = apre == null ? null : ae.lookupNamespaceURI(apre); if (apre == null || aprens == null || !aprens.equals(ans)) { String newpre = ae.lookupPrefix(ans); if (newpre != null) { a.setPrefix(newpre); } else { if (apre != null && ae.lookupNamespaceURI(apre) == null) { e.setAttributeNS (XMLConstants.XMLNS_NAMESPACE_URI, for (;;) { newpre = "NS" + index; if (ae.lookupPrefix(newpre) == null) { e.setAttributeNS (XMLConstants.XMLNS_NAMESPACE_URI,
/** * Deeply exports this node to the given document. */ protected Node deepExport(Node n, AbstractDocument d) { super.deepExport(n, d); AbstractElementNS ae = (AbstractElementNS)n; ae.namespaceURI = namespaceURI; return n; }
/** * Removes the scripting listeners from the given element. */ protected void removeScriptingListenersOn(Element elt) { String eltNS = elt.getNamespaceURI(); String eltLN = elt.getLocalName(); if (SVGConstants.SVG_NAMESPACE_URI.equals(eltNS) && SVG12Constants.SVG_HANDLER_TAG.equals(eltLN)) { // For this 'handler' element, remove the handler for the given // event type. AbstractElement tgt = (AbstractElement) elt.getParentNode(); String eventType = elt.getAttributeNS (XMLConstants.XML_EVENTS_NAMESPACE_URI, XMLConstants.XML_EVENTS_EVENT_ATTRIBUTE); String eventNamespaceURI = XMLConstants.XML_EVENTS_NAMESPACE_URI; if (eventType.indexOf(':') != -1) { String prefix = DOMUtilities.getPrefix(eventType); eventType = DOMUtilities.getLocalName(eventType); eventNamespaceURI = ((AbstractElement) elt).lookupNamespaceURI(prefix); } EventListener listener = (EventListener) handlerScriptingListeners.put (eventNamespaceURI, eventType, elt, null); tgt.removeEventListenerNS (eventNamespaceURI, eventType, listener, false); } super.removeScriptingListenersOn(elt); }
eventType = DOMUtilities.getLocalName(eventType); eventNamespaceURI = ((AbstractElement) elt).lookupNamespaceURI(prefix); tgt.addEventListenerNS (eventNamespaceURI, eventType, listener, false, null); if (handlerScriptingListeners == null) {
/** * <b>DOM</b>: Implements {@link org.w3c.dom.Element#getTagName()}. * * @return {@link #getNodeName()}. */ public String getTagName() { return getNodeName(); }
tgt.addEventListenerNS (eventNamespaceURI, eventType, listener, false, null); if (handlerScriptingListeners == null) {
if (node.isId()) ownerDocument.addIdEntry(this, newv); attrAdded(node, newv); break; if (node.isId()) ownerDocument.updateIdEntry(this, oldv, newv); attrModified(node, oldv, newv); break; if (node.isId()) ownerDocument.removeIdEntry(this, oldv); attrRemoved(node, oldv); AbstractDocument doc = getCurrentDocument(); if (doc.getEventsEnabled() && !oldv.equals(newv)) { DOMMutationEvent ev dispatchEvent(ev);