/** * Returns the element name */ public String getNodeName() { if (needsSyncData()) { synchronizeData(); } return name; }
/** * Method getSchemaTypeInfo. * @return TypeInfo */ public TypeInfo getSchemaTypeInfo(){ if(needsSyncData()) { synchronizeData(); } return this; }
/** * Returns the name of the Element. Note that Element.nodeName() is * defined to also return the tag name. * <p> * This is case-preserving in XML. HTML should uppercasify it on the * way in. */ public String getTagName() { if (needsSyncData()) { synchronizeData(); } return name; }
/** * Introduced in DOM Level 2. */ public boolean hasAttributes() { if (needsSyncData()) { synchronizeData(); } return (attributes != null && attributes.getLength() != 0); }
/** * NON-DOM: get inded of an attribute */ protected int getXercesAttribute(String namespaceURI, String localName){ if (needsSyncData()) { synchronizeData(); } if (attributes == null) { return -1; } return attributes.getNamedItemIndex(namespaceURI, localName); }
/** * Look up a single Attribute by name. Returns the Attribute's * string value, or an empty string (NOT null!) to indicate that the * name did not map to a currently defined attribute. * <p> * Note: Attributes may contain complex node trees. This method * returns the "flattened" string obtained from Attribute.getValue(). * If you need the structure information, see getAttributeNode(). */ public String getAttribute(String name) { if (needsSyncData()) { synchronizeData(); } if (attributes == null) { return ""; } Attr attr = (Attr)(attributes.getNamedItem(name)); return (attr == null) ? "" : attr.getValue(); } // getAttribute(String):String
/** * Retrieve all the Attributes as a set. Note that this API is inherited * from Node rather than specified on Element; in fact only Elements will * ever have Attributes, but they want to allow folks to "blindly" operate * on the tree as a set of Nodes. */ public NamedNodeMap getAttributes() { if (needsSyncData()) { synchronizeData(); } if (attributes == null) { attributes = new AttributeMap(this, null); } return attributes; } // getAttributes():NamedNodeMap
/** * Introduced in DOM Level 2. <p> * * Retrieves an attribute value by local name and namespace URI. * * @param namespaceURI * The namespace URI of the attribute to * retrieve. * @param localName The local name of the attribute to retrieve. * @return String The Attr value as a string, or empty string * if that attribute * does not have a specified or default value. * @since WD-DOM-Level-2-19990923 */ public String getAttributeNS(String namespaceURI, String localName) { if (needsSyncData()) { synchronizeData(); } if (attributes == null) { return ""; } Attr attr = (Attr)(attributes.getNamedItemNS(namespaceURI, localName)); return (attr == null) ? "" : attr.getValue(); } // getAttributeNS(String,String):String
/** * Look up a single Attribute by name. Returns the Attribute Node, * so its complete child tree is available. This could be important in * XML, where the string rendering may not be sufficient information. * <p> * If no matching attribute is available, returns null. */ public Attr getAttributeNode(String name) { if (needsSyncData()) { synchronizeData(); } if (attributes == null) { return null; } return (Attr)attributes.getNamedItem(name); } // getAttributeNode(String):Attr
/** * Retrieves an Attr node by local name and namespace URI. * * @param namespaceURI The namespace URI of the attribute to * retrieve. * @param localName The local name of the attribute to retrieve. * @return Attr The Attr node with the specified attribute * local name and namespace * URI or null if there is no such attribute. * @since WD-DOM-Level-2-19990923 */ public Attr getAttributeNodeNS(String namespaceURI, String localName){ if (needsSyncData()) { synchronizeData(); } if (attributes == null) { return null; } return (Attr)attributes.getNamedItemNS(namespaceURI, localName); } // getAttributeNodeNS(String,String):Attr
/** * NON-DOM: sets attribute node for this element */ protected int setXercesAttributeNode (Attr attr){ if (needsSyncData()) { synchronizeData(); } if (attributes == null) { attributes = new AttributeMap(this, null); } return attributes.addItem(attr); }
void moveSpecifiedAttributes(ElementImpl el) { if (needsSyncData()) { synchronizeData(); } if (el.hasAttributes()) { if (attributes == null) { attributes = new AttributeMap(this, null); } attributes.moveSpecifiedAttributes(el.attributes); } }
/** * DOM Level 3: register the given attribute node as an ID attribute */ public void setIdAttributeNode(Attr at, boolean makeId) { 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 (at.getOwnerElement() != this) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null); throw new DOMException(DOMException.NOT_FOUND_ERR, msg); } } ((AttrImpl) at).isIdAttribute(makeId); if (!makeId) { ownerDocument.removeIdentifier(at.getValue()); } else { ownerDocument.putIdentifier(at.getValue(), this); } }
/** * Remove the named attribute from this Element. If the removed * Attribute has a default value, it is immediately replaced thereby. * <P> * The default logic is actually implemented in NamedNodeMapImpl. * PR-DOM-Level-1-19980818 doesn't fully address the DTD, so some * of this behavior is likely to change in future versions. ????? * <P> * Note that this call "succeeds" even if no attribute by this name * existed -- unlike removeAttributeNode, which will throw a not-found * exception in that case. * * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if the node is * readonly. */ public void removeAttribute(String name) { if (ownerDocument.errorChecking && isReadOnly()) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (needsSyncData()) { synchronizeData(); } if (attributes == null) { return; } attributes.safeRemoveNamedItem(name); } // removeAttribute(String)
/** * Introduced in DOM Level 2. <p> * * Removes an attribute by local name and namespace URI. If the removed * attribute has a default value it is immediately replaced. * The replacing attribute has the same namespace URI and local name, * as well as the original prefix.<p> * * @param namespaceURI The namespace URI of the attribute to remove. * * @param localName The local name of the attribute to remove. * @throws NO_MODIFICATION_ALLOWED_ERR: Raised if this * node is readonly. * @since WD-DOM-Level-2-19990923 */ public void removeAttributeNS(String namespaceURI, String localName) { if (ownerDocument.errorChecking && isReadOnly()) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null); throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg); } if (needsSyncData()) { synchronizeData(); } if (attributes == null) { return; } attributes.safeRemoveNamedItemNS(namespaceURI, localName); } // removeAttributeNS(String,String)
void rename(String name) { if (needsSyncData()) { synchronizeData(); } if (ownerDocument.errorChecking) { int colon1 = name.indexOf(':'); if(colon1 != -1){ String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "NAMESPACE_ERR", null); throw new DOMException(DOMException.NAMESPACE_ERR, msg); } if (!CoreDocumentImpl.isXMLName(name, ownerDocument.isXML11Version())) { String msg = DOMMessageFormatter.formatMessage( DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null); throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg); } } this.name = name; reconcileDefaultAttributes(); }
boolean makeId) { if (needsSyncData()) { synchronizeData();