/** {@inheritDoc} */
 public HtmlElement createElementNS(
     final SgmlPage page,
     final String namespaceURI,
     final String qualifiedName,
     final Attributes attributes) {
   final Map<String, DomAttr> attributeMap = DefaultElementFactory.setAttributes(page, attributes);
   return new HtmlUnknownElement(page, namespaceURI, qualifiedName, attributeMap);
 }
  /** {@inheritDoc} */
  public HtmlElement createElementNS(
      final SgmlPage page,
      final String namespaceURI,
      final String qualifiedName,
      final Attributes attributes) {

    Map<String, DomAttr> attributeMap = DefaultElementFactory.setAttributes(page, attributes);
    if (attributeMap == null) {
      attributeMap = new HashMap<String, DomAttr>();
    }

    String type = null;
    if (attributes != null) {
      type = attributes.getValue("type");
    }
    if (type == null) {
      type = "";
    } else {
      type = type.toLowerCase();
      attributeMap.get("type").setValue(type); // type value has to be lower case
    }

    final HtmlInput result;
    if (type.length() == 0) {
      // This not an illegal value, as it defaults to "text"
      // cf http://www.w3.org/TR/REC-html40/interact/forms.html#adef-type-INPUT
      // and the common browsers seem to treat it as a "text" input so we will as well.
      HtmlElement.addAttributeToMap(page, attributeMap, null, "type", "text");
      result = new HtmlTextInput(namespaceURI, qualifiedName, page, attributeMap);
    } else if ("submit".equals(type)) {
      result = new HtmlSubmitInput(namespaceURI, qualifiedName, page, attributeMap);
    } else if ("checkbox".equals(type)) {
      result = new HtmlCheckBoxInput(namespaceURI, qualifiedName, page, attributeMap);
    } else if ("radio".equals(type)) {
      result = new HtmlRadioButtonInput(namespaceURI, qualifiedName, page, attributeMap);
    } else if ("text".equals(type)) {
      result = new HtmlTextInput(namespaceURI, qualifiedName, page, attributeMap);
    } else if ("hidden".equals(type)) {
      result = new HtmlHiddenInput(namespaceURI, qualifiedName, page, attributeMap);
    } else if ("password".equals(type)) {
      result = new HtmlPasswordInput(namespaceURI, qualifiedName, page, attributeMap);
    } else if ("image".equals(type)) {
      result = new HtmlImageInput(namespaceURI, qualifiedName, page, attributeMap);
    } else if ("reset".equals(type)) {
      result = new HtmlResetInput(namespaceURI, qualifiedName, page, attributeMap);
    } else if ("button".equals(type)) {
      result = new HtmlButtonInput(namespaceURI, qualifiedName, page, attributeMap);
    } else if ("file".equals(type)) {
      result = new HtmlFileInput(namespaceURI, qualifiedName, page, attributeMap);
    } else {
      LOG.info("Bad input type: \"" + type + "\", creating a text input");
      result = new HtmlTextInput(namespaceURI, qualifiedName, page, attributeMap);
    }
    return result;
  }