public static void removeCSSClass(Element e,String cssclass){
  String oldval=e.getAttribute(SVGConstants.SVG_CLASS_ATTRIBUTE);
  if (oldval == null) {
    return;
  }
  String[] classes=oldval.split(" ");
  if (classes.length == 1) {
    if (cssclass.equals(classes[0])) {
      e.removeAttribute(SVGConstants.SVG_CLASS_ATTRIBUTE);
    }
  }
 else   if (classes.length == 2) {
    if (cssclass.equals(classes[0])) {
      if (cssclass.equals(classes[1])) {
        e.removeAttribute(SVGConstants.SVG_CLASS_ATTRIBUTE);
      }
 else {
        e.setAttribute(SVGConstants.SVG_CLASS_ATTRIBUTE,classes[1]);
      }
    }
 else     if (cssclass.equals(classes[1])) {
      e.setAttribute(SVGConstants.SVG_CLASS_ATTRIBUTE,classes[0]);
    }
  }
 else {
    StringBuilder joined=new StringBuilder();
    for (    String c : classes) {
      if (!c.equals(cssclass)) {
        if (joined.length() > 0) {
          joined.append(' ');
        }
        joined.append(c);
      }
    }
    e.setAttribute(SVGConstants.SVG_CLASS_ATTRIBUTE,joined.toString());
  }
}

public static void removeCSSClass ( Element e , String cssclass ) { String oldval = e . getAttribute ( SVGConstants . SVG_CLASS_ATTRIBUTE ) ; if ( oldval == null ) { return ; } String [ ] classes = oldval . split ( " " ) ; if ( classes . length == 1 ) { if ( cssclass . equals ( classes [ 0 ] ) ) { e . removeAttribute ( SVGConstants . SVG_CLASS_ATTRIBUTE ) ; } } else if ( classes . length == 2 ) { if ( cssclass . equals ( classes [ 0 ] ) ) { if ( cssclass . equals ( classes [ 1 ] ) ) { e . removeAttribute ( SVGConstants . SVG_CLASS_ATTRIBUTE ) ; } else { e . setAttribute ( SVGConstants . SVG_CLASS_ATTRIBUTE , classes [ 1 ] ) ; } } else if ( cssclass . equals ( classes [ 1 ] ) ) { e . setAttribute ( SVGConstants . SVG_CLASS_ATTRIBUTE , classes [ 0 ] ) ; } } else { StringBuilder joined = new StringBuilder ( ) ; for ( String c : classes ) { if ( ! c . equals ( cssclass ) ) { if ( joined . length ( ) > 0 ) { joined . append ( ' ' ) ; } joined . append ( c ) ; } } e . setAttribute ( SVGConstants . SVG_CLASS_ATTRIBUTE , joined . toString ( ) ) ; } }
remove a css class from an element .
