/** * Returns the specified attribute. * @param namespaceURI the namespace URI * @param localName the local name of the attribute to look for * @return the specified attribute, {@code null} if the attribute is not defined */ @JsxFunction public Object getAttributeNodeNS(final String namespaceURI, final String localName) { return getDomNodeOrDie().getAttributeNodeNS(namespaceURI, localName).getScriptableObject(); }
/** * Retrieves an attribute node by name. * @param name the name of the attribute to retrieve * @return the XMLAttr node with the specified name or {@code null} if there is no such attribute */ @JsxFunction public Object getAttributeNode(final String name) { final Map<String, DomAttr> attributes = getDomNodeOrDie().getAttributesMap(); for (final DomAttr attr : attributes.values()) { if (attr.getName().equals(name)) { return attr.getScriptableObject(); } } return null; }
/** * Retrieves an attribute node by name. * @param name the name of the attribute to retrieve * @return the XMLAttr node with the specified name or {@code null} if there is no such attribute */ @JsxFunction public Object getAttributeNode(final String name) { final Map<String, DomAttr> attributes = getDomNodeOrDie().getAttributesMap(); for (final DomAttr attr : attributes.values()) { if (attr.getName().equals(name)) { return attr.getScriptableObject(); } } return null; }
/** * Creates a new HTML attribute with the specified name. * * @param attributeName the name of the attribute to create * @return an attribute with the specified name */ @JsxFunction public Attr createAttribute(final String attributeName) { return getPage().createAttribute(attributeName).getScriptableObject(); }
/** * Creates a new HTML attribute with the specified name. * * @param attributeName the name of the attribute to create * @return an attribute with the specified name */ @JsxFunction public Attr createAttribute(final String attributeName) { return getPage().createAttribute(attributeName).getScriptableObject(); }
/** * Returns the specified attribute. * @param namespaceURI the namespace URI * @param localName the local name of the attribute to look for * @return the specified attribute, {@code null} if the attribute is not defined */ @JsxFunction public Object getAttributeNodeNS(final String namespaceURI, final String localName) { return getDomNodeOrDie().getAttributeNodeNS(namespaceURI, localName).getScriptableObject(); }
/** * Returns the attribute node. * @param name the name of the attribute to return * @return the attribute node with the supplied name, {@code null} if the named attribute cannot be found * on this element */ @JsxFunction public Object getAttributeNode(final String name) { if (name == null || "null".equals(name)) { throw Context.reportRuntimeError("Type mismatch."); } if (StringUtils.isEmpty(name)) { throw Context.reportRuntimeError("The empty string '' is not a valid name."); } final Map<String, DomAttr> attributes = getDomNodeOrDie().getAttributesMap(); for (final DomAttr attr : attributes.values()) { if (attr.getName().equals(name)) { return attr.getScriptableObject(); } } return null; }
/** * Returns the attribute node. * @param name the name of the attribute to return * @return the attribute node with the supplied name, {@code null} if the named attribute cannot be found * on this element */ @JsxFunction public Object getAttributeNode(final String name) { if (name == null || "null".equals(name)) { throw Context.reportRuntimeError("Type mismatch."); } if (StringUtils.isEmpty(name)) { throw Context.reportRuntimeError("The empty string '' is not a valid name."); } final Map<String, DomAttr> attributes = getDomNodeOrDie().getAttributesMap(); for (final DomAttr attr : attributes.values()) { if (attr.getName().equals(name)) { return attr.getScriptableObject(); } } return null; }