use of org.w3c.dom.DocumentFragment in project robovm by robovm.
the class ImportNode method testImportNode4.
public void testImportNode4() throws Throwable {
Document doc;
Document aNewDoc;
DocumentFragment docFrag;
Comment comment;
Node aNode;
NodeList children;
Node child;
String childValue;
doc = (Document) load("staff", builder);
aNewDoc = (Document) load("staff", builder);
docFrag = aNewDoc.createDocumentFragment();
comment = aNewDoc.createComment("descendant1");
aNode = docFrag.appendChild(comment);
aNode = doc.importNode(docFrag, true);
children = aNode.getChildNodes();
assertEquals("throw_Size", 1, children.getLength());
child = aNode.getFirstChild();
childValue = child.getNodeValue();
assertEquals("descendant1", "descendant1", childValue);
}
use of org.w3c.dom.DocumentFragment in project robovm by robovm.
the class DocumentImportNode method testImportNode10.
public void testImportNode10() throws Throwable {
Document doc;
DocumentFragment docFragment;
NodeList childList;
boolean success;
Node addressNode;
Node importedDocFrag;
doc = (Document) load("staffNS", builder);
docFragment = doc.createDocumentFragment();
childList = doc.getElementsByTagNameNS("*", "address");
addressNode = childList.item(0);
docFragment.appendChild(addressNode);
importedDocFrag = doc.importNode(docFragment, true);
success = importedDocFrag.hasChildNodes();
assertTrue("documentimportnode10", success);
}
use of org.w3c.dom.DocumentFragment in project robovm by robovm.
the class DocumentImportNode method testImportNode9.
public void testImportNode9() throws Throwable {
Document doc;
DocumentFragment docFragment;
NodeList childList;
boolean success;
Node addressNode;
Node importedDocFrag;
doc = (Document) load("staffNS", builder);
docFragment = doc.createDocumentFragment();
childList = doc.getElementsByTagNameNS("*", "address");
addressNode = childList.item(0);
docFragment.appendChild(addressNode);
importedDocFrag = doc.importNode(docFragment, false);
success = importedDocFrag.hasChildNodes();
assertFalse("documentimportnode09", success);
}
use of org.w3c.dom.DocumentFragment in project robovm by robovm.
the class HCNodeDocumentFragmentNormalize method testNodeDocumentFragmentNormalize2.
public void testNodeDocumentFragmentNormalize2() throws Throwable {
Document doc;
DocumentFragment docFragment;
Text txtNode;
doc = (Document) load("hc_staff", builder);
docFragment = doc.createDocumentFragment();
txtNode = doc.createTextNode("");
docFragment.appendChild(txtNode);
docFragment.normalize();
txtNode = (Text) docFragment.getFirstChild();
assertNull("noChild", txtNode);
}
use of org.w3c.dom.DocumentFragment in project robovm by robovm.
the class HCNodeDocumentFragmentNormalize method testNodeDocumentFragmentNormalize1.
/**
* Runs the test case.
*
* @throws Throwable
* Any uncaught exception causes test to fail
*/
public void testNodeDocumentFragmentNormalize1() throws Throwable {
Document doc;
DocumentFragment docFragment;
String nodeValue;
Text txtNode;
Node retval;
doc = (Document) load("hc_staff", builder);
docFragment = doc.createDocumentFragment();
txtNode = doc.createTextNode("foo");
retval = docFragment.appendChild(txtNode);
txtNode = doc.createTextNode("bar");
retval = docFragment.appendChild(txtNode);
docFragment.normalize();
txtNode = (Text) docFragment.getFirstChild();
nodeValue = txtNode.getNodeValue();
assertEquals("normalizedNodeValue", "foobar", nodeValue);
retval = txtNode.getNextSibling();
assertNull("singleChild", retval);
}
Aggregations