Here you can find the source of writeAttribute(XMLStreamWriter xmlw, String name, String value)
private static void writeAttribute(XMLStreamWriter xmlw, String name, String value) throws XMLStreamException
//package com.java2s; //License from project: Apache License import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; public class Main { private static void writeAttribute(XMLStreamWriter xmlw, String name, String value) throws XMLStreamException { if (!StringUtilisEmpty(value)) { xmlw.writeAttribute(name, value); }/*w w w. ja va 2 s . c om*/ } private static boolean StringUtilisEmpty(String str) { if (str == null || str.trim().equals("")) { return true; } return false; } }