Java XML Attribute Set setAttribute(Element targetElem, String name, String value)

Here you can find the source of setAttribute(Element targetElem, String name, String value)

Description

set Attribute

License

Open Source License

Declaration

protected static void setAttribute(Element targetElem, String name,
            String value) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2015 Bruno Medeiros and other Contributors.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/* w w  w. j a  va 2s  . c o  m*/
 *     Bruno Medeiros - initial API and implementation
 *******************************************************************************/

import org.w3c.dom.Element;

public class Main {
    protected static void setAttribute(Element targetElem, String name,
            String value) {
        if (value != null) {
            targetElem.setAttribute(name, value);
        }
    }
}

Related

  1. setAttribute(Element element, String attribute, String attributeValue, String attributeDefaultValue)
  2. setAttribute(Element element, String attributeName, String attributeValue)
  3. setAttribute(Element element, String attributeName, String value)
  4. setAttribute(Element element, String attrName, Object value)
  5. setAttribute(Element element, String name, String value)
  6. setAttribute(final Element element, final String attrName, final Object value)
  7. setAttribute(final Element element, final String name, final String value)
  8. setAttribute(Node n, String name, String value)
  9. setAttribute(Node node, String attName, String val)