use of org.w3c.dom.Attr in project robovm by robovm.
the class NamedNodeMapGetNamedItemNS method testGetNamedItemNS2.
/**
* Runs the test case.
*
* @throws Throwable
* Any uncaught exception causes test to fail
*/
// Assumes validation.
// public void testGetNamedItemNS1() throws Throwable {
// Document doc;
// DocumentType docType;
// NamedNodeMap entities;
// NamedNodeMap notations;
// Entity entity;
// Notation notation;
//
// String nullNS = null;
//
// doc = (Document) load("staffNS", builder);
// docType = doc.getDoctype();
// entities = docType.getEntities();
// assertNotNull("entitiesNotNull", entities);
// notations = docType.getNotations();
// assertNotNull("notationsNotNull", notations);
// entity = (Entity) entities.getNamedItemNS(nullNS, "ent1");
// assertNotNull("entityNull", entity);
// notation = (Notation) notations.getNamedItemNS(nullNS, "notation1");
// assertNotNull("notationNull", notation);
// }
public void testGetNamedItemNS2() throws Throwable {
Document doc;
NamedNodeMap attributes;
Node element;
Attr attribute;
NodeList elementList;
String attrName;
doc = (Document) load("staffNS", builder);
elementList = doc.getElementsByTagNameNS("http://www.nist.gov", "address");
element = elementList.item(1);
attributes = element.getAttributes();
attribute = (Attr) attributes.getNamedItemNS("http://www.nist.gov", "domestic");
attrName = attribute.getNodeName();
assertEquals("namednodemapgetnameditemns02", "emp:domestic", attrName);
}
use of org.w3c.dom.Attr in project robovm by robovm.
the class NamedNodeMapRemoveNamedItemNS method testRemoveNamedItemNS1.
/**
* Runs the test case.
*
* @throws Throwable
* Any uncaught exception causes test to fail
*/
public void testRemoveNamedItemNS1() throws Throwable {
Document doc;
NamedNodeMap attributes;
Node element;
Attr attribute;
NodeList elementList;
doc = (Document) load("staffNS", builder);
elementList = doc.getElementsByTagNameNS("http://www.nist.gov", "address");
element = elementList.item(1);
attributes = element.getAttributes();
attribute = (Attr) attributes.removeNamedItemNS("http://www.nist.gov", "domestic");
attribute = (Attr) attributes.getNamedItemNS("http://www.nist.gov", "domestic");
assertNull("namednodemapremovenameditemns01", attribute);
}
use of org.w3c.dom.Attr in project robovm by robovm.
the class NamedNodeMapSetNamedItemNS method testSetNamedItemNS2.
public void testSetNamedItemNS2() throws Throwable {
Document doc;
NamedNodeMap attributes;
Element element;
Attr attribute;
Attr attribute1;
String attrName;
doc = (Document) load("staffNS", builder);
element = doc.createElementNS("http://www.w3.org/DOM/Test", "root");
attribute1 = doc.createAttributeNS("http://www.w3.org/DOM/L1", "L1:att");
attributes = element.getAttributes();
attributes.setNamedItemNS(attribute1);
attribute = (Attr) attributes.getNamedItemNS("http://www.w3.org/DOM/L1", "att");
attrName = attribute.getNodeName();
assertEquals("namednodemapsetnameditemns02", "L1:att", attrName);
}
use of org.w3c.dom.Attr in project robovm by robovm.
the class NamedNodeMapSetNamedItemNS method testSetNamedItemNS1.
/**
* Runs the test case.
*
* @throws Throwable
* Any uncaught exception causes test to fail
*/
public void testSetNamedItemNS1() throws Throwable {
Document doc;
NamedNodeMap attributes;
Node element;
Attr attribute;
Attr newAttr1;
NodeList elementList;
String attrName;
doc = (Document) load("staffNS", builder);
elementList = doc.getElementsByTagNameNS("http://www.nist.gov", "address");
element = elementList.item(0);
attributes = element.getAttributes();
newAttr1 = doc.createAttributeNS("http://www.w3.org/DOM/L1", "streets");
((Element) /* Node */
element).setAttributeNodeNS(newAttr1);
attribute = (Attr) attributes.getNamedItemNS("http://www.w3.org/DOM/L1", "streets");
attrName = attribute.getNodeName();
assertEquals("namednodemapsetnameditemns01", "streets", attrName);
}
use of org.w3c.dom.Attr 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