Package javax.swing.text.html.parser

Examples of javax.swing.text.html.parser.Element


  public void testGetElement()
  {
    D d = new D();
    HTML.Tag[] tags = HTML.getAllTags();

    Element prehead = d.createElement("head");

    for (int i = 0; i < tags.length; i++)
      {
        Element e = d.createElement(tags [ i ].toString());
        String name = tags [ i ].toString();
        assertNotNull("Element creation", e);
        assertTrue("Element name", e.getName().equalsIgnoreCase(name));
      }

    // Test upper/lowercase
    Element e = d.createElement("head");

    assertNotNull("Element creation", e);
    assertTrue("Element name", e.getName().equalsIgnoreCase("head"));
    assertEquals(HTML.Tag.HEAD, HTML.getTag(e.name));
    assertEquals("Field assignment", d.head, e);

    assertEquals(prehead, e);
  }
View Full Code Here


      HTML.Tag tags[] = HTML.getAllTags();

      for (int i = 0; i < tags.length; i++) {
        HTML.Tag t = tags[i];
        String tn = t.toString();
        Element e = DTD.getDTD("test").getElement("e");
        e.name = tn;

        TagElement te = new TagElement(e, true);
        harness.check(te.fictional());
View Full Code Here

    for (int i = 0; i < tags.length; i++)
      {
        HTML.Tag t = tags [ i ];
        String tn = t.toString();
        Element e = DTD.getDTD("test").getElement("e");
        e.name = tn;

        TagElement te = new TagElement(e, true);
        assertTrue(" must be fictional", te.fictional());
View Full Code Here

        a.value = "v" + i;
        list.next = a;
        list = a;
      }

    Element e = DTD.getDTD("test").getElement("e");
    e.atts = head;

    for (int i = 0; i < 24; i++)
      {
        // Check if the name is found.
        assertEquals(e.getAttribute("a" + i).toString(), "a" + i);

        // Check if the attribute value is correct.
        assertEquals(e.getAttribute("a" + i).value, "v" + i);

        // Check if the attribute can be found by value.
        assertEquals(e.getAttributeByValue("v" + i).name, "a" + i);
      }

    // Check is the null value is searched correctly.
    assertEquals(e.getAttributeByValue(null).toString(), "heading");

    // Check for unknown attribute
    assertEquals(e.getAttribute("audrius"), null);

    // Check for unknown value
    assertEquals(e.getAttributeByValue("audrius"), null);
  }
View Full Code Here

        }
    }

    public void testGetElementUpperOutOfBounds() {
        try {
            Element e = dtd.getElement(dtd.elements.size());
            fail("IndexOutOfBoundsException didn't raised as RI, but method returned: " + e);
        } catch (IndexOutOfBoundsException e) {
            // Expected
        }
    }
View Full Code Here

public class ContentModelSemanticTest extends TestCase {

    DTDGetter dtd = new DTDGetter("TestContentModelSemantic");

    public void testContentModelSemantic_0_1() {
        Element el1 = newElement("el1");
        Element el2 = newElement("el2");
        ContentModel cm1 = newContentModel('?', ',', 0, 0, el1, el2);

        assertEquals(cm1.toString(), "(el1 , el2)?");
    }
View Full Code Here

        assertEquals(cm1.toString(), "(el1 , el2)?");
    }

    public void testContentModelSemantic_0_2() {
        Element el1 = newElement("el1");
        Element el2 = newElement("el2");
        ContentModel cm1 = newContentModel('?', ',', 0, 0, el1, el2);

        assertEquals(cm1.empty(), true);
    }
View Full Code Here

        assertEquals(cm1.empty(), true);
    }

    public void testContentModelSemantic_0_3() {
        Element el1 = newElement("el1");
        Element el2 = newElement("el2");
        ContentModel cm1 = newContentModel('?', ',', 0, 0, el1, el2);

        assertNull(cm1.first());
    }
View Full Code Here

        assertNull(cm1.first());
    }

    public void testContentModelSemantic_0_4() {
        Element el1 = newElement("el1");
        Element el2 = newElement("el2");
        ContentModel cm1 = newContentModel('?', ',', 0, 0, el1, el2);

        assertTrue(cm1.first(el1));
    }
View Full Code Here

        assertTrue(cm1.first(el1));
    }

    public void testContentModelSemantic_0_5() {
        Element el1 = newElement("el1");
        Element el2 = newElement("el2");
        ContentModel cm1 = newContentModel('?', ',', 0, 0, el1, el2);

        assertFalse(cm1.first(el2));
    }
View Full Code Here

TOP

Related Classes of javax.swing.text.html.parser.Element

Copyright © 2018 www.massapicom. 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.