Examples of HtmlAttributes


Examples of nu.validator.htmlparser.impl.HtmlAttributes

    boolean isEndTag = CajaTreeBuilder.isEndTag(start.text);
    String tagName = start.text.substring(isEndTag ? 2 : 1);
    boolean isHtml = checkName(tagName);
    if (isHtml) { tagName = Strings.lower(tagName); }

    HtmlAttributes htmlAttrs = new HtmlAttributes(AttributeName.HTML);
    boolean hasXmlns = false;
    List<Attr> attrs = Lists.newArrayList();
    if (!attrStubs.isEmpty()) {
      for (AttrStub as : attrStubs) {
        String qname = as.nameTok.text;
        Attr attrNode;
        boolean isAttrHtml;
        try {
          String name;
          if ("xmlns".equals(qname)) {
            if (!Namespaces.HTML_NAMESPACE_URI.equals(as.value)) {
              // We do not allow overriding of the default namespace when
              // parsing HTML.
              mq.addMessage(
                  MessageType.CANNOT_OVERRIDE_DEFAULT_NAMESPACE_IN_HTML,
                  as.nameTok.pos);
            } else {
              hasXmlns = true;
            }
            continue;
          } else {
            isAttrHtml = isHtml && checkName(qname);
            if (isAttrHtml) {
              name = Strings.lower(qname);
              attrNode = maybeCreateAttributeNs(Namespaces.HTML_NAMESPACE_URI,
                                                name, as);
              if (attrNode == null) {
                // Ignore this attribute.
                continue;
              }
            } else {
              name = AttributeNameFixup.fixupNameFromQname(qname);
              attrNode = maybeCreateAttribute(name, as);
              if (attrNode == null) {
                // Ignore this attribute.
                continue;
              }
            }
          }
          attrNode.setValue(as.value);
          if (needsDebugData) {
            Nodes.setFilePositionFor(attrNode, as.nameTok.pos);
            Nodes.setFilePositionForValue(attrNode, as.valueTok.pos);
            Nodes.setRawValue(attrNode, as.valueTok.text);
          }
          attrs.add(attrNode);
          try {
            htmlAttrs.addAttribute(
                AttributeName.nameByString(name),
                as.value, XmlViolationPolicy.ALLOW);
          } catch (SAXException ex) {
            if (CajaTreeBuilder.DEBUG) { ex.printStackTrace(); }
          }
View Full Code Here

Examples of org.rendersnake.HtmlAttributes

        HtmlCanvas html = new HtmlCanvas();
        html.write("<&>");
        assertEquals("&lt;&amp;&gt;",html.toHtml());
    }
    public void testAttributeContent() throws Exception {
        HtmlAttributes attrs = new HtmlAttributes();
        attrs.content("<&>");
        assertEquals(" content=\"&lt;&amp;&gt;\"",attrs.toHtml());
    }
View Full Code Here

Examples of org.rendersnake.HtmlAttributes

    public void test_id() throws IOException {
        assertEquals(" id=\"id\"", new HtmlAttributes().id("id").toHtml());
    }

    public void test_selected() throws IOException {
        assertEquals(" selected=\"selected\"", new HtmlAttributes().selected("selected").toHtml());
    }
View Full Code Here

Examples of org.rendersnake.HtmlAttributes

    public void test_selected() throws IOException {
        assertEquals(" selected=\"selected\"", new HtmlAttributes().selected("selected").toHtml());
    }

    public void test_ismap() throws IOException {
        assertEquals(" ismap=\"ismap\"", new HtmlAttributes().ismap("ismap").toHtml());
    }
View Full Code Here

Examples of org.rendersnake.HtmlAttributes

    public void test_ismap() throws IOException {
        assertEquals(" ismap=\"ismap\"", new HtmlAttributes().ismap("ismap").toHtml());
    }

    public void test_style() throws IOException {
        assertEquals(" style=\"style\"", new HtmlAttributes().style("style").toHtml());
    }
View Full Code Here

Examples of org.rendersnake.HtmlAttributes

    public void test_style() throws IOException {
        assertEquals(" style=\"style\"", new HtmlAttributes().style("style").toHtml());
    }

    public void test_dir() throws IOException {
        assertEquals(" dir=\"dir\"", new HtmlAttributes().dir("dir").toHtml());
    }
View Full Code Here

Examples of org.rendersnake.HtmlAttributes

    public void test_dir() throws IOException {
        assertEquals(" dir=\"dir\"", new HtmlAttributes().dir("dir").toHtml());
    }

    public void test_alt() throws IOException {
        assertEquals(" alt=\"alt\"", new HtmlAttributes().alt("alt").toHtml());
    }
View Full Code Here

Examples of org.rendersnake.HtmlAttributes

    public void test_alt() throws IOException {
        assertEquals(" alt=\"alt\"", new HtmlAttributes().alt("alt").toHtml());
    }

    public void test_name() throws IOException {
        assertEquals(" name=\"name\"", new HtmlAttributes().name("name").toHtml());
    }
View Full Code Here

Examples of org.rendersnake.HtmlAttributes

    public void test_name() throws IOException {
        assertEquals(" name=\"name\"", new HtmlAttributes().name("name").toHtml());
    }

    public void test_onMouseup() throws IOException {
        assertEquals(" onmouseup=\"onmouseup\"", new HtmlAttributes().onMouseup("onmouseup").toHtml());
    }
View Full Code Here

Examples of org.rendersnake.HtmlAttributes

    public void test_onMouseup() throws IOException {
        assertEquals(" onmouseup=\"onmouseup\"", new HtmlAttributes().onMouseup("onmouseup").toHtml());
    }

    public void test_nowrap() throws IOException {
        assertEquals(" nowrap=\"nowrap\"", new HtmlAttributes().nowrap("nowrap").toHtml());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.