use of org.w3c.dom.DOMException in project robovm by robovm.
the class NamedNodeMapRemoveNamedItemNS method testRemoveNamedItemNS6.
// Assumes validation.
// public void testRemoveNamedItemNS5() throws Throwable {
// Document doc;
// DocumentType docType;
// NamedNodeMap entities;
// NamedNodeMap notations;
//
// String nullNS = null;
//
// doc = (Document) load("staffNS", builder);
// docType = doc.getDoctype();
// entities = docType.getEntities();
// assertNotNull("entitiesNotNull", entities);
// notations = docType.getNotations();
// assertNotNull("notationsNotNull", notations);
//
// try {
// entities.removeNamedItemNS(nullNS, "ent1");
// fail("entity_throw_DOMException");
//
// } catch (DOMException ex) {
// switch (ex.code) {
// case 8:
// break;
// case 7:
// break;
// default:
// throw ex;
// }
// }
//
// try {
// notations.removeNamedItemNS(nullNS, "notation1");
// fail("notation_throw_DOMException");
//
// } catch (DOMException ex) {
// switch (ex.code) {
// case 8:
// break;
// case 7:
// break;
// default:
// throw ex;
// }
// }
// }
public void testRemoveNamedItemNS6() throws Throwable {
Document doc;
NamedNodeMap attributes;
Node element;
NodeList elementList;
doc = (Document) load("staffNS", builder);
elementList = doc.getElementsByTagNameNS("http://www.nist.gov", "employee");
element = elementList.item(1);
attributes = element.getAttributes();
{
boolean success = false;
try {
attributes.removeNamedItemNS("http://www.Nist.gov", "domestic");
} catch (DOMException ex) {
success = (ex.code == DOMException.NOT_FOUND_ERR);
}
assertTrue("throw_NOT_FOUND_ERR", success);
}
}
use of org.w3c.dom.DOMException in project robovm by robovm.
the class NamedNodeMapRemoveNamedItemNS method testRemoveNamedItemNS7.
public void testRemoveNamedItemNS7() throws Throwable {
Document doc;
NamedNodeMap attributes;
Node element;
NodeList elementList;
doc = (Document) load("staffNS", builder);
elementList = doc.getElementsByTagNameNS("http://www.nist.gov", "employee");
element = elementList.item(1);
attributes = element.getAttributes();
{
boolean success = false;
try {
attributes.removeNamedItemNS("http://www.nist.gov", "domestic");
} catch (DOMException ex) {
success = (ex.code == DOMException.NOT_FOUND_ERR);
}
assertTrue("throw_NOT_FOUND_ERR", success);
}
}
use of org.w3c.dom.DOMException in project robovm by robovm.
the class Prefix method _testGetPrefix6.
public void _testGetPrefix6() throws Throwable {
Document doc;
NodeList elementList;
Node employeeNode;
doc = (Document) load("staffNS", builder);
elementList = doc.getElementsByTagName("employee");
employeeNode = elementList.item(0);
{
boolean success = false;
try {
employeeNode.setPrefix("pre^fix xmlns='http//www.nist.gov'");
} catch (DOMException ex) {
success = (ex.code == DOMException.INVALID_CHARACTER_ERR);
}
assertTrue("throw_INVALID_CHARACTER_ERR", success);
}
}
use of org.w3c.dom.DOMException in project robovm by robovm.
the class Prefix method testGetPrefix10.
public void testGetPrefix10() throws Throwable {
Document doc;
NodeList elementList;
Node employeeNode;
doc = (Document) load("staffNS", builder);
elementList = doc.getElementsByTagName("employee");
employeeNode = elementList.item(1);
{
boolean success = false;
try {
employeeNode.setPrefix("xml");
} catch (DOMException ex) {
success = (ex.code == DOMException.NAMESPACE_ERR);
}
assertTrue("throw_NAMESPACE_ERR", success);
}
}
use of org.w3c.dom.DOMException in project robovm by robovm.
the class Prefix method _testGetPrefix9.
// Assumes validation.
// public void testGetPrefix8() throws Throwable {
// Document doc;
// NodeList genderList;
// Node genderNode;
// Node entRef;
// Node entElement;
//
// int nodeType;
// doc = (Document) load("staff", builder);
// genderList = doc.getElementsByTagName("gender");
// genderNode = genderList.item(2);
// entRef = genderNode.getFirstChild();
// nodeType = (int) entRef.getNodeType();
//
// if (1 == nodeType) {
// entRef = doc.createEntityReference("ent4");
// assertNotNull("createdEntRefNotNull", entRef);
// }
// entElement = entRef.getFirstChild();
// assertNotNull("entElement", entElement);
// doc.createElement("text3");
//
// {
// boolean success = false;
// try {
// entElement.setPrefix("newPrefix");
// } catch (DOMException ex) {
// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
// }
// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR", success);
// }
// }
public void _testGetPrefix9() throws Throwable {
Document doc;
NodeList elementList;
Element addrNode;
Attr addrAttr;
doc = (Document) load("staffNS", builder);
elementList = doc.getElementsByTagName("address");
addrNode = (Element) elementList.item(3);
addrAttr = addrNode.getAttributeNode("xmlns");
{
boolean success = false;
try {
addrAttr.setPrefix("xxx");
} catch (DOMException ex) {
success = (ex.code == DOMException.NAMESPACE_ERR);
}
assertTrue("throw_NAMESPACE_ERR", success);
}
}
Aggregations