public static Location newLocation(CSSParseException cpe) {
    LocationImpl loc = new LocusTransformer().new LocationImpl();
    try {
      loc.setColumnNumber(cpe.getColumnNumber());
      loc.setLineNumber(cpe.getLineNumber());
      loc.setSystemId(cpe.getURI());
    } catch (Exception e) {
    }

    return loc;
  }
 public void warning(final CSSParseException exception) throws CSSException {
   final StringBuilder sb = new StringBuilder();
   sb.append(exception.getURI())
       .append(" [")
       .append(exception.getLineNumber())
       .append(":")
       .append(exception.getColumnNumber())
       .append("] ")
       .append(exception.getMessage());
   System.err.println(sb.toString());
 }
 public void setMediaText(final String mediaText) throws DOMException {
   final InputSource source = new InputSource(new StringReader(mediaText));
   try {
     final CSSOMParser parser = new CSSOMParser();
     parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE);
     final SACMediaList sml = parser.parseMedia(source);
     setMediaList(sml);
   } catch (final CSSParseException e) {
     throw new DOMException(DOMException.SYNTAX_ERR, e.getLocalizedMessage());
   } catch (final IOException e) {
     throw new DOMException(DOMException.NOT_FOUND_ERR, e.getLocalizedMessage());
   }
 }