documentcreateentityreferenceknownpublic final class documentcreateentityreferenceknown extends org.w3c.domts.DOMTestCase The "createEntityReference(name)" method creates an
EntityReference node. In addition, if the referenced entity
is known, the child list of the "EntityReference" node
is the same as the corresponding "Entity" node.
Retrieve the entire DOM document and invoke its
"createEntityReference(name)" method. It should create
a new EntityReference node for the Entity with the
given name. The referenced entity is known, therefore the child
list of the "EntityReference" node is the same as the corresponding
"Entity" node. |
Constructors Summary |
---|
public documentcreateentityreferenceknown(org.w3c.domts.DOMTestDocumentBuilderFactory factory)Constructor.
super(factory);
//
// check if loaded documents are supported for content type
//
String contentType = getContentType();
preload(contentType, "staff", true);
|
Methods Summary |
---|
public java.lang.String | getTargetURI()Gets URI that identifies the test.
return "http://www.w3.org/2001/DOM-Test-Suite/level1/core/documentcreateentityreferenceknown";
| public static void | main(java.lang.String[] args)Runs this test from the command line.
DOMTestCase.doMain(documentcreateentityreferenceknown.class, args);
| public void | runTest()Runs the test case.
Document doc;
EntityReference newEntRefNode;
NodeList newEntRefList;
Node child;
String name;
String value;
doc = (Document) load("staff", true);
newEntRefNode = doc.createEntityReference("ent3");
assertNotNull("createdEntRefNotNull", newEntRefNode);
newEntRefList = newEntRefNode.getChildNodes();
assertSize("size", 1, newEntRefList);
child = newEntRefNode.getFirstChild();
name = child.getNodeName();
assertEquals("name", "#text", name);
value = child.getNodeValue();
assertEquals("value", "Texas", value);
|
|