use of org.w3c.dom.DOMException in project robovm by robovm.
the class NodeSetPrefix method testSetPrefix5.
// Relies on validation, which we don't support.
// public void testSetPrefix4() throws Throwable {
// Document doc;
// Element element;
// Attr attribute;
// NodeList elementList;
// String nullNS = null;
//
// doc = (Document) load("staffNS", builder);
// elementList = doc.getElementsByTagName("emp:employee");
// element = (Element) elementList.item(0);
// assertNotNull("empEmployeeNotNull", element);
// attribute = element.getAttributeNodeNS(nullNS, "defaultAttr");
//
// {
// boolean success = false;
// try {
// attribute.setPrefix("test");
// } catch (DOMException ex) {
// success = (ex.code == DOMException.NAMESPACE_ERR);
// }
// assertTrue("nodesetprefix04", success);
// }
// }
public void testSetPrefix5() throws Throwable {
Document doc;
Element element;
String prefixValue;
List<String> prefixValues = new ArrayList<String>();
prefixValues.add("_:");
prefixValues.add(":0");
prefixValues.add(":");
prefixValues.add("_::");
prefixValues.add("a:0:c");
doc = (Document) load("staffNS", builder);
element = doc.createElementNS("http://www.w3.org/DOM/Test/L2", "dom:elem");
for (int indexN10050 = 0; indexN10050 < prefixValues.size(); indexN10050++) {
prefixValue = (String) prefixValues.get(indexN10050);
{
boolean success = false;
try {
element.setPrefix(prefixValue);
} 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 NodeSetPrefix method testSetPrefix7.
public void testSetPrefix7() throws Throwable {
Document doc;
Attr attribute;
doc = (Document) load("staffNS", builder);
attribute = doc.createAttributeNS("http://www.w3.org/DOM/Test/L2", "abc:elem");
{
boolean success = false;
try {
attribute.setPrefix("xmlns");
} 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 NodeSetPrefix method _testSetPrefix9.
public void _testSetPrefix9() throws Throwable {
Document doc;
String value = "#$%&'()@";
Element element;
doc = (Document) load("staffNS", builder);
element = doc.createElementNS("http://www.w3.org/DOM/Test/L2", "dom:elem");
{
boolean success = false;
try {
element.setPrefix(value);
} 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 NamedNodeMapSetNamedItemNS method testSetNamedItemNS6.
// Assumes validation.
// public void testSetNamedItemNS5() throws Throwable {
// Document doc;
// DocumentType docType;
// NamedNodeMap entities;
// NamedNodeMap notations;
// Entity entity;
// Notation notation;
//
// doc = (Document) load("staffNS", builder);
// docType = doc.getDoctype();
// entities = docType.getEntities();
// assertNotNull("entitiesNotNull", entities);
// notations = docType.getNotations();
// assertNotNull("notationsNotNull", notations);
// entity = (Entity) entities.getNamedItem("ent1");
// notation = (Notation) notations.getNamedItem("notation1");
//
// {
// boolean success = false;
// try {
// entities.setNamedItemNS(entity);
// } catch (DOMException ex) {
// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
// }
// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_entities", success);
// }
//
// {
// boolean success = false;
// try {
// notations.setNamedItemNS(notation);
// } catch (DOMException ex) {
// success = (ex.code == DOMException.NO_MODIFICATION_ALLOWED_ERR);
// }
// assertTrue("throw_NO_MODIFICATION_ALLOWED_ERR_notations", success);
// }
// }
public void testSetNamedItemNS6() throws Throwable {
Document doc;
NamedNodeMap attributes;
NodeList elementList;
Element element;
Attr attr;
doc = (Document) load("staffNS", builder);
elementList = doc.getElementsByTagNameNS("*", "address");
element = (Element) elementList.item(0);
attributes = element.getAttributes();
attr = (Attr) attributes.getNamedItemNS("http://www.usa.com", "domestic");
element = (Element) elementList.item(1);
attributes = element.getAttributes();
{
boolean success = false;
try {
attributes.setNamedItemNS(attr);
} catch (DOMException ex) {
success = (ex.code == DOMException.INUSE_ATTRIBUTE_ERR);
}
assertTrue("namednodemapsetnameditemns06", success);
}
}
use of org.w3c.dom.DOMException in project robovm by robovm.
the class NamedNodeMapSetNamedItemNS method testSetNamedItemNS4.
public void testSetNamedItemNS4() throws Throwable {
Document doc;
DOMImplementation domImpl;
Document docAlt;
DocumentType docType = null;
NamedNodeMap attributes;
NodeList elementList;
Element element;
Attr attrAlt;
String nullNS = null;
doc = (Document) load("staffNS", builder);
elementList = doc.getElementsByTagNameNS("*", "address");
element = (Element) elementList.item(1);
attributes = element.getAttributes();
domImpl = doc.getImplementation();
docAlt = domImpl.createDocument(nullNS, "newDoc", docType);
attrAlt = docAlt.createAttributeNS(nullNS, "street");
{
boolean success = false;
try {
attributes.setNamedItemNS(attrAlt);
} catch (DOMException ex) {
success = (ex.code == DOMException.WRONG_DOCUMENT_ERR);
}
assertTrue("throw_WRONG_DOCUMENT_ERR", success);
}
}
Aggregations