/** * BORROWED from Xerces impl. Cloning a NamedNodeMap is a DEEP OPERATION; it always clones all * the nodes contained in the map. */ public NamedNodeMapImpl cloneMap(NodeImpl ownerNode) { AttributeMap newmap = new AttributeMap((ParentNode) ownerNode); newmap.hasDefaults(hasDefaults()); newmap.cloneContent(this); return newmap; } // cloneMap():AttributeMap
public Node cloneNode(boolean deep) { ElementImpl newnode = (ElementImpl) super.cloneNode(deep); // Replicate NamedNodeMap rather than sharing it. if (attributes != null) { newnode.attributes = (AttributeMap) attributes.cloneMap(newnode); } return newnode; }
/** * Retrieves an attribute node by name. * * @see org.w3c.dom.Element#getAttributeNode(String) */ public Attr getAttributeNode(String name) { return (this.attributes == null) ? null : (AttrImpl) this.attributes .getNamedItem(name); }
AttributeMap attributeMap = new AttributeMap(this); for (int i = 0; i < this.attributes.getLength(); i++) { attributeMap.addItem((Attr) this.attributes.getItem(i)); OMConstants.XMLNS_NS_URI, OMConstants.XMLNS_NS_PREFIX)); attributeMap.addItem(attr); OMConstants.XMLNS_NS_URI, OMConstants.XMLNS_NS_PREFIX)); attributeMap.addItem(attr);
this.attributes = new AttributeMap(this); return (Attr) this.attributes.setNamedItem(attr);
if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, attr.isOwned(true); // To indicate that this attr belong to an element int i = findNamePoint(attr.getNamespaceURI(), attr.getLocalName()); AttrImpl previous = null; i = findNamePoint(attr.getNodeName(), 0); if (i >= 0) { previous = (AttrImpl) nodes.elementAt(i);
/** @see org.apache.axiom.om.OMElement#getAllAttributes() */ public Iterator getAllAttributes() { if (attributes == null) { return EMPTY_ITERATOR; } ArrayList list = new ArrayList(); for (int i = 0; i < attributes.getLength(); i++) { OMAttribute item = (OMAttribute) attributes.getItem(i); if (item.getNamespace() == null || !(item.getNamespace() != null && OMConstants.XMLNS_NS_URI .equals(item.getNamespace().getNamespaceURI()))) { list.add(item); } } return list.iterator(); }
/** * Removes the specified attribute node. * * @see org.w3c.dom.Element#removeAttributeNode(org.w3c.dom.Attr) */ public Attr removeAttributeNode(Attr oldAttr) throws DOMException { if (isReadonly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (this.attributes == null || this.attributes.getNamedItem(oldAttr.getName()) == null) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } return (AttrImpl) this.attributes.removeNamedItem(oldAttr .getName()); }
this.attributes = new AttributeMap(this); return (Attr) this.attributes.setNamedItemNS(attr);
/** @param ownerDocument */ public ElementImpl(DocumentImpl ownerDocument, String tagName, OMFactory factory) { super(ownerDocument, factory); this.localName = tagName; this.attributes = new AttributeMap(this); this.done = true; }
/** * Retrieves an attribute node by local name and namespace URI. * * @see org.w3c.dom.Element#getAttributeNodeNS(String, String) */ public Attr getAttributeNodeNS(String namespaceURI, String localName) { if (OMConstants.XMLNS_NS_URI.equals(namespaceURI)) { OMNamespace ns = this.findNamespaceURI(localName); String nsuri = ns != null ? ns.getNamespaceURI() : ""; AttrImpl namespaceAttr = new AttrImpl(this.ownerNode, localName, nsuri, this.factory); NamespaceImpl xmlNs = new NamespaceImpl(OMConstants.XMLNS_NS_URI); namespaceAttr.setOMNamespace(xmlNs); return namespaceAttr; } return (this.attributes == null) ? null : (Attr) this.attributes .getNamedItemNS(namespaceURI, localName); }
this.attributes = new AttributeMap(this); .getPrefix(qualifiedName))); tempAttr.setAttributeValue(value); this.attributes.setNamedItem(tempAttr); return tempAttr; } else { .getOwnerDocument(), DOMUtil .getLocalName(qualifiedName), ns, value, this.factory); this.attributes.setNamedItem(attr); return attr; AttrImpl tempAttr = ((AttrImpl) attributeNode); tempAttr.setAttributeValue(value); this.attributes.setNamedItem(tempAttr); return tempAttr; } else { AttrImpl attr = new AttrImpl((DocumentImpl) this .getOwnerDocument(), qualifiedName, value, this.factory); this.attributes.setNamedItem(attr); return attr;
if (isReadOnly()) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, attr.setUsed(true); // Setting used to true int i = findNamePoint(attr.getNodeName(), 0);
public ElementImpl(DocumentImpl ownerDocument, String tagName, NamespaceImpl ns, OMXMLParserWrapper builder, OMFactory factory) { super(ownerDocument, factory); this.localName = tagName; this.namespace = ns; this.builder = builder; this.declareNamespace(ns); this.attributes = new AttributeMap(this); }
public ElementImpl(String tagName, NamespaceImpl ns, OMXMLParserWrapper builder, OMFactory factory) { this(factory); this.localName = tagName; this.namespace = ns; this.builder = builder; if (ns != null) { this.declareNamespace(ns); } this.attributes = new AttributeMap(this); }
/** * Looks in the local list of attributes and returns if found. If the local list is null, * returns "". * * @see org.w3c.dom.Element#getAttribute(String) */ public String getAttribute(String name) { if (attributes == null) { return ""; } else { Attr attr = ((Attr) attributes.getNamedItem(name)); return (attr != null) ? attr.getValue() : ""; } }
/** * Creates a new element with the namespace. * * @param ownerDocument * @param tagName * @param ns */ public ElementImpl(DocumentImpl ownerDocument, String tagName, NamespaceImpl ns, OMFactory factory) { super(ownerDocument, factory); this.localName = tagName; this.namespace = ns; this.declareNamespace(ns); this.attributes = new AttributeMap(this); this.done = true; }