@Nonnull
  private CSSImportRule _createImportRule(@Nonnull final CSSNode aNode) {
    _expectNodeType(aNode, ECSSNodeType.IMPORTRULE);
    final int nChildCount = aNode.jjtGetNumChildren();
    if (nChildCount > 2)
      _throwUnexpectedChildrenCount(
          aNode, "Expected at last 2 children but got " + nChildCount + "!");

    CSSURI aImportURI = null;
    int nCurrentIndex = 0;
    if (nChildCount > 0) {
      final CSSNode aURINode = aNode.jjtGetChild(0);
      if (ECSSNodeType.URL.isNode(aURINode, m_eVersion)) {
        aImportURI = new CSSURI(aURINode.getText());
        aImportURI.setSourceLocation(aURINode.getSourceLocation());
        ++nCurrentIndex;
      } else if (!ECSSNodeType.MEDIALIST.isNode(aURINode, m_eVersion))
        throw new IllegalStateException(
            "Expected an URI or MEDIALIST node but got "
                + ECSSNodeType.getNodeName(aURINode, m_eVersion));
    }

    if (aImportURI == null) {
      // No URI child node present, so the location is printed directly
      // E.g. @import "abc.css"
      aImportURI = new CSSURI(CSSParseHelper.extractStringValue(aNode.getText()));
    }

    // Import rule
    final CSSImportRule ret = new CSSImportRule(aImportURI);
    ret.setSourceLocation(aNode.getSourceLocation());
    if (nChildCount > nCurrentIndex) {
      // We have a media query present!
      final CSSNode aMediaListNode = aNode.jjtGetChild(nCurrentIndex);
      if (ECSSNodeType.MEDIALIST.isNode(aMediaListNode, m_eVersion)) {
        for (final CSSNode aMediaQueryNode : aMediaListNode) {
          ret.addMediaQuery(_createMediaQuery(aMediaQueryNode));
        }
        ++nCurrentIndex;
      } else
        s_aLogger.error(
            "Expected an MEDIALIST node but got "
                + ECSSNodeType.getNodeName(aMediaListNode, m_eVersion));
    }

    if (nCurrentIndex < nChildCount)
      s_aLogger.error("Import statement has children which are unhandled.");
    return ret;
  }
  @Nonnull
  private CSSNamespaceRule _createNamespaceRule(@Nonnull final CSSNode aNode) {
    _expectNodeType(aNode, ECSSNodeType.NAMESPACERULE);
    final int nChildCount = aNode.jjtGetNumChildren();
    if (nChildCount < 1 || nChildCount > 2)
      _throwUnexpectedChildrenCount(
          aNode, "Expected at least 1 child and at last 2 children but got " + nChildCount + "!");

    String sPrefix = null;
    int nURLIndex = 0;
    if (ECSSNodeType.NAMESPACERULEPREFIX.isNode(aNode.jjtGetChild(0), m_eVersion)) {
      sPrefix = aNode.jjtGetChild(0).getText();
      nURLIndex++;
    }

    final CSSNode aURLNode = aNode.jjtGetChild(nURLIndex);
    _expectNodeType(aURLNode, ECSSNodeType.NAMESPACERULEURL);
    final String sURL = CSSParseHelper.extractStringValue(aURLNode.getText());

    final CSSNamespaceRule ret = new CSSNamespaceRule(sPrefix, sURL);
    ret.setSourceLocation(aNode.getSourceLocation());
    return ret;
  }