code: public void setMediaText(final String mediaText) throws DOMException {
          try {
              final CSSOMParser parser = new CSSOMParser();
              parser.setErrorHandler(ThrowCssExceptionErrorHandler.INSTANCE);
              final MediaQueryList sml = parser.parseMedia(mediaText);
              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());
          }
      }
docs: Parses the given media text.
  @param mediaText text to be parsed
  @throws DOMException in case of error