public int getLength(){ return(fAttributes != null)?fAttributes.getLength():0; }
public void setAttributes(AttributeMap attributes, CoreDocumentImpl doc, ElementImpl elem) { fDocument = doc; fAttributes = attributes; fElement = elem; if (attributes != null) { int length = attributes.getLength(); fDTDTypes.setSize(length); fAugmentations.setSize(length); // REVISIT: this implementation does not store any value in augmentations // and basically not keeping augs in parallel to attributes map // untill all attributes are added (default attributes) for (int i = 0; i < length; i++) { fAugmentations.setElementAt(new AugmentationsImpl(), i); } } else { fDTDTypes.setSize(0); fAugmentations.setSize(0); } }
/** * Introduced in DOM Level 2. */ public boolean hasAttributes() { if (needsSyncData()) { synchronizeData(); } return (attributes != null && attributes.getLength() != 0); }
@Override public Node cloneNode(boolean deep) { OdfElement cloneElement = ((OdfFileDom) this.ownerDocument).newOdfElement(this.getClass()); if (attributes != null) { for (int i = 0; i < attributes.getLength(); i++) { Node item = attributes.item(i); String qname = null; String prefix = item.getPrefix(); if (prefix == null) { qname = item.getLocalName(); } else { qname = prefix + ":" + item.getLocalName(); } cloneElement.setAttributeNS(item.getNamespaceURI(), qname, item.getNodeValue()); } } if (deep) { Node childNode = getFirstChild(); while (childNode != null) { cloneElement.appendChild(childNode.cloneNode(true)); childNode = childNode.getNextSibling(); } } return cloneElement; }
@Override public Node cloneNode(boolean deep) { OdfElement cloneElement = this.cloneOdfElement(); if (attributes != null) { for (int i = 0; i < attributes.getLength(); i++) { Node item = attributes.item(i); String qname = null; String prefix = item.getPrefix(); if (prefix == null) { qname = item.getLocalName(); cloneElement.setAttribute(qname, item.getNodeValue()); } else { qname = prefix + ":" + item.getLocalName(); cloneElement.setAttributeNS(item.getNamespaceURI(), qname, item.getNodeValue()); } } } if (deep) { Node childNode = getFirstChild(); while (childNode != null) { cloneElement.appendChild(childNode.cloneNode(true)); childNode = childNode.getNextSibling(); } } return cloneElement; }
@Override public Node cloneNode(boolean deep) { OdfElement cloneElement = this.cloneOdfElement(); if (attributes != null) { for (int i = 0; i < attributes.getLength(); i++) { Node item = attributes.item(i); String qname = null; String prefix = item.getPrefix(); if (prefix == null) { qname = item.getLocalName(); cloneElement.setAttribute(qname, item.getNodeValue()); } else { qname = prefix + ":" + item.getLocalName(); cloneElement.setAttributeNS(item.getNamespaceURI(), qname, item.getNodeValue()); } } } if (deep) { Node childNode = getFirstChild(); while (childNode != null) { cloneElement.appendChild(childNode.cloneNode(true)); childNode = childNode.getNextSibling(); } } return cloneElement; }
for (int x = 0; x < map.getLength(); x++) { String name = map.item(x).getNodeName(); newParent.setAttribute(name, map.item(x).getNodeValue());
for (int k = 0; k < attributes.getLength(); ++k) { Attr attr = (Attr)attributes.getItem(k); uri = attr.getNamespaceURI();
for( int i=0; i<attributes.getLength(); ++i )