use of org.w3c.dom.DOMException in project robovm by robovm.
the class ElementSetAttributeNodeNS method testSetAttributeNodeNS4.
public void testSetAttributeNodeNS4() throws Throwable {
Document doc;
Element element1;
Element element2;
Attr attribute;
doc = (Document) load("staffNS", builder);
element1 = doc.createElementNS("http://www.w3.org/DOM/Test", "elem1");
element2 = doc.createElementNS("http://www.w3.org/DOM/Test", "elem2");
attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test", "attr");
element1.setAttributeNodeNS(attribute);
{
boolean success = false;
try {
element2.setAttributeNodeNS(attribute);
} catch (DOMException ex) {
success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
}
assertTrue("elementsetattributenodens04", success);
}
}
use of org.w3c.dom.DOMException in project robovm by robovm.
the class ImportNode method testImportNode16.
public void testImportNode16() throws Throwable {
Document doc;
Document anotherDoc;
DocumentType docType;
doc = (Document) load("staffNS", builder);
anotherDoc = (Document) load("staffNS", builder);
docType = anotherDoc.getDoctype();
{
boolean success = false;
try {
doc.importNode(docType, false);
} catch (DOMException ex) {
success = (ex.code == DOMException.NOT_SUPPORTED_ERR);
}
assertTrue("throw_NOT_SUPPORTED_ERR", success);
}
}
use of org.w3c.dom.DOMException in project robovm by robovm.
the class ImportNode method testImportNode17.
public void testImportNode17() throws Throwable {
Document doc;
Document anotherDoc;
doc = (Document) load("staffNS", builder);
anotherDoc = (Document) load("staffNS", builder);
{
boolean success = false;
try {
doc.importNode(anotherDoc, false);
} catch (DOMException ex) {
success = (ex.code == DOMException.NOT_SUPPORTED_ERR);
}
assertTrue("throw_NOT_SUPPORTED_ERR", success);
}
}
use of org.w3c.dom.DOMException in project robovm by robovm.
the class HCNamedNodeMapInvalidType method testNamedNodeMapInvalidType.
/**
* Runs the test case.
*
* @throws Throwable
* Any uncaught exception causes test to fail
*/
public void testNamedNodeMapInvalidType() throws Throwable {
Document doc;
NamedNodeMap attributes;
Element docElem;
Element newElem;
doc = (Document) load("hc_staff", builder);
docElem = doc.getDocumentElement();
attributes = docElem.getAttributes();
newElem = doc.createElement("html");
{
boolean success = false;
try {
attributes.setNamedItem(newElem);
} catch (DOMException ex) {
success = (ex.code == DOMException.HIERARCHY_REQUEST_ERR);
}
assertTrue("throw_HIERARCHY_REQUEST_ERR", success);
}
}
use of org.w3c.dom.DOMException in project robovm by robovm.
the class HCNotationsRemoveNamedItemNS method testRemoveNamedItemNS.
/**
* Runs the test case.
*
* @throws Throwable
* Any uncaught exception causes test to fail
*/
public void testRemoveNamedItemNS() throws Throwable {
Document doc;
NamedNodeMap notations;
DocumentType docType;
doc = (Document) load("hc_staff", builder);
docType = doc.getDoctype();
if (!(("text/html".equals(getContentType())))) {
assertNotNull("docTypeNotNull", docType);
notations = docType.getNotations();
assertNotNull("notationsNotNull", notations);
try {
notations.removeNamedItemNS("http://www.w3.org/1999/xhtml", "alpha");
fail("throw_NO_MOD_OR_NOT_FOUND_ERR");
} catch (DOMException ex) {
switch(ex.code) {
case 7:
break;
case 8:
break;
default:
throw ex;
}
}
}
}
Aggregations