Here you can find the source of writeAttribute(XMLStreamWriter writer, String name, Object value)
public static void writeAttribute(XMLStreamWriter writer, String name, Object value) throws XMLStreamException
//package com.java2s; /******************************************************************************* * Copyright (c) 2012 Firestar Software, Inc. * 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:/*from w w w . j ava 2 s. co m*/ * Firestar Software, Inc. - initial API and implementation * * Author: * Gabriel Oancea * *******************************************************************************/ import javax.xml.stream.*; public class Main { public static void writeAttribute(XMLStreamWriter writer, String name, Object value) throws XMLStreamException { if (value != null) { writer.writeAttribute(name, value.toString()); } } public static void writeAttribute(XMLStreamWriter writer, String name, Object value, String namespace) throws XMLStreamException { if (value != null) { writer.writeAttribute(namespace, name, value.toString()); } } }