use of org.w3c.dom.NamedNodeMap in project robovm by robovm.
the class GetNamedItemNS method testGetNamedItemNS2.
public void testGetNamedItemNS2() throws Throwable {
String namespaceURI = "http://www.usa.com";
String localName = "domest";
Document doc;
NodeList elementList;
Node testEmployee;
NamedNodeMap attributes;
Attr newAttr;
doc = (Document) load("staffNS", builder);
elementList = doc.getElementsByTagName("address");
testEmployee = elementList.item(1);
attributes = testEmployee.getAttributes();
newAttr = (Attr) attributes.getNamedItemNS(namespaceURI, localName);
assertNull("throw_Null", newAttr);
}
use of org.w3c.dom.NamedNodeMap 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.NamedNodeMap 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;
}
}
}
}
use of org.w3c.dom.NamedNodeMap in project hazelcast by hazelcast.
the class XmlConfigBuilder method handleList.
private void handleList(Node node) {
Node attName = node.getAttributes().getNamedItem("name");
String name = getTextContent(attName);
ListConfig lConfig = new ListConfig();
lConfig.setName(name);
for (Node n : childElements(node)) {
String nodeName = cleanNodeName(n);
String value = getTextContent(n).trim();
if ("max-size".equals(nodeName)) {
lConfig.setMaxSize(getIntegerValue("max-size", value));
} else if ("backup-count".equals(nodeName)) {
lConfig.setBackupCount(getIntegerValue("backup-count", value));
} else if ("async-backup-count".equals(nodeName)) {
lConfig.setAsyncBackupCount(getIntegerValue("async-backup-count", value));
} else if ("item-listeners".equals(nodeName)) {
for (Node listenerNode : childElements(n)) {
if ("item-listener".equals(cleanNodeName(listenerNode))) {
NamedNodeMap attrs = listenerNode.getAttributes();
boolean incValue = getBooleanValue(getTextContent(attrs.getNamedItem("include-value")));
String listenerClass = getTextContent(listenerNode);
lConfig.addItemListenerConfig(new ItemListenerConfig(listenerClass, incValue));
}
}
} else if ("statistics-enabled".equals(nodeName)) {
lConfig.setStatisticsEnabled(getBooleanValue(value));
}
}
this.config.addListConfig(lConfig);
}
use of org.w3c.dom.NamedNodeMap in project camel by apache.
the class BeanDefinitionParser method doParse.
protected void doParse(Element element, BeanDefinitionBuilder builder) {
NamedNodeMap attributes = element.getAttributes();
for (int x = 0; x < attributes.getLength(); x++) {
Attr attribute = (Attr) attributes.item(x);
String name = attribute.getLocalName();
String fullName = attribute.getName();
// assign id if we want them
if (fullName.equals("id") && isAssignId()) {
if (attribute.getValue() != null) {
builder.addPropertyValue("id", attribute.getValue());
}
// assign other attributes if eligible
} else if (!fullName.startsWith("xmlns:") && !fullName.equals("xmlns") && isEligibleAttribute(name)) {
String propertyName = extractPropertyName(name);
Assert.state(StringUtils.hasText(propertyName), "Illegal property name returned from 'extractPropertyName(String)': cannot be null or empty.");
builder.addPropertyValue(propertyName, attribute.getValue());
}
}
postProcess(builder, element);
}
Aggregations