本文整理了Java中org.dom4j.Attribute.getData()
方法的一些代码示例,展示了Attribute.getData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attribute.getData()
方法的具体详情如下:
包路径:org.dom4j.Attribute
类名称:Attribute
方法名:getData
[英]Accesses the data of this attribute which may implement data typing bindings such as XML Schema
or Java Bean
bindings or will return the same value as Node#getText().
[中]访问此属性的数据,该属性可能实现数据类型绑定,如XML Schema
或Java Bean
绑定,或将返回与节点#getText()相同的值。
代码示例来源:origin: org.dom4j/dom4j
protected static boolean booleanValue(Attribute attribute) {
if (attribute == null) {
return false;
}
Object value = attribute.getData();
if (value == null) {
return false;
} else if (value instanceof Boolean) {
Boolean b = (Boolean) value;
return b.booleanValue();
} else {
return "true".equalsIgnoreCase(value.toString());
}
}
}
代码示例来源:origin: Nepxion/Discovery
throw new DiscoveryException("Attribute[" + ConfigConstant.SERVICE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
String serviceName = serviceNameAttribute.getData().toString().trim();
throw new DiscoveryException("Attribute[" + ConfigConstant.KEY_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
String key = keyAttribute.getData().toString().trim();
throw new DiscoveryException("Attribute[" + ConfigConstant.VALUE_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
String value = valueAttribute.getData().toString().trim();
代码示例来源:origin: Nepxion/Discovery
String globalFilterValue = globalFilterAttribute.getData().toString().trim();
if (StringUtils.isNotEmpty(globalFilterValue)) {
Integer globalValue = null;
throw new DiscoveryException("Attribute[" + ConfigConstant.SERVICE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
String serviceName = serviceNameAttribute.getData().toString().trim();
String filterValue = filterValueAttribute.getData().toString().trim();
if (StringUtils.isNotEmpty(filterValue)) {
try {
代码示例来源:origin: Nepxion/Discovery
throw new DiscoveryException("Attribute[" + ConfigConstant.CONSUMER_SERVICE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
String consumerServiceName = consumerServiceNameAttribute.getData().toString().trim();
versionEntity.setConsumerServiceName(consumerServiceName);
throw new DiscoveryException("Attribute[" + ConfigConstant.PROVIDER_SERVICE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
String providerServiceName = providerServiceNameAttribute.getData().toString().trim();
versionEntity.setProviderServiceName(providerServiceName);
String consumerVersionValue = consumerVersionValueAttribute.getData().toString().trim();
List<String> consumerVersionValueList = StringUtil.splitToList(consumerVersionValue, DiscoveryConstant.SEPARATE);
versionEntity.setConsumerVersionValueList(consumerVersionValueList);
String providerVersionValue = providerVersionValueAttribute.getData().toString().trim();
List<String> providerVersionValueList = StringUtil.splitToList(providerVersionValue, DiscoveryConstant.SEPARATE);
versionEntity.setProviderVersionValueList(providerVersionValueList);
代码示例来源:origin: Nepxion/Discovery
String globalFilterValue = globalFilterAttribute.getData().toString().trim();
List<String> globalFilterValueList = StringUtil.splitToList(globalFilterValue, DiscoveryConstant.SEPARATE);
hostFilterEntity.setFilterValueList(globalFilterValueList);
throw new DiscoveryException("Attribute[" + ConfigConstant.SERVICE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
String serviceName = serviceNameAttribute.getData().toString().trim();
String filterValue = filterValueAttribute.getData().toString().trim();
filterValueList = StringUtil.splitToList(filterValue, DiscoveryConstant.SEPARATE);
代码示例来源:origin: Nepxion/Discovery
String consumerServiceName = null;
if (consumerServiceNameAttribute != null) {
consumerServiceName = consumerServiceNameAttribute.getData().toString().trim();
} else {
consumerServiceName = StringUtils.EMPTY;
throw new DiscoveryException("Attribute[" + ConfigConstant.PROVIDER_SERVICE_NAME_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
String providerServiceName = providerServiceNameAttribute.getData().toString().trim();
weightEntity.setProviderServiceName(providerServiceName);
throw new DiscoveryException("Attribute[" + ConfigConstant.PROVIDER_WEIGHT_VALUE_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
String providerWeightValue = providerWeightValueAttribute.getData().toString().trim();
Map<String, Integer> weightMap = new LinkedHashMap<String, Integer>();
List<String> providerWeightValueList = StringUtil.splitToList(providerWeightValue, DiscoveryConstant.SEPARATE);
throw new DiscoveryException("Attribute[" + ConfigConstant.PROVIDER_WEIGHT_VALUE_ATTRIBUTE_NAME + "] in element[" + childElement.getName() + "] is missing");
String providerWeightValue = providerWeightValueAttribute.getData().toString().trim();
Map<String, Integer> weightMap = new LinkedHashMap<String, Integer>();
List<String> providerWeightValueList = StringUtil.splitToList(providerWeightValue, DiscoveryConstant.SEPARATE);
代码示例来源:origin: dom4j/dom4j
protected static boolean booleanValue(Attribute attribute) {
if (attribute == null) {
return false;
}
Object value = attribute.getData();
if (value == null) {
return false;
} else if (value instanceof Boolean) {
Boolean b = (Boolean) value;
return b.booleanValue();
} else {
return "true".equalsIgnoreCase(value.toString());
}
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.dom4j
protected static boolean booleanValue(Attribute attribute) {
if (attribute == null) {
return false;
}
Object value = attribute.getData();
if (value == null) {
return false;
} else if (value instanceof Boolean) {
Boolean b = (Boolean) value;
return b.booleanValue();
} else {
return "true".equalsIgnoreCase(value.toString());
}
}
}
代码示例来源:origin: maven/dom4j
protected static boolean booleanValue(Attribute attribute) {
if (attribute == null) {
return false;
}
Object value = attribute.getData();
if (value == null) {
return false;
} else if (value instanceof Boolean) {
Boolean b = (Boolean) value;
return b.booleanValue();
} else {
return "true".equalsIgnoreCase(value.toString());
}
}
}
代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand
protected static boolean booleanValue(Attribute attribute) {
if (attribute == null) {
return false;
}
Object value = attribute.getData();
if (value == null) {
return false;
} else if (value instanceof Boolean) {
Boolean b = (Boolean) value;
return b.booleanValue();
} else {
return "true".equalsIgnoreCase(value.toString());
}
}
}
代码示例来源:origin: org.jenkins-ci.dom4j/dom4j
protected static boolean booleanValue(Attribute attribute) {
if (attribute == null) {
return false;
}
Object value = attribute.getData();
if (value == null) {
return false;
} else if (value instanceof Boolean) {
Boolean b = (Boolean) value;
return b.booleanValue();
} else {
return "true".equalsIgnoreCase(value.toString());
}
}
}
代码示例来源:origin: apache/servicemix-bundles
protected static boolean booleanValue(Attribute attribute) {
if (attribute == null) {
return false;
}
Object value = attribute.getData();
if (value == null) {
return false;
} else if (value instanceof Boolean) {
Boolean b = (Boolean) value;
return b.booleanValue();
} else {
return "true".equalsIgnoreCase(value.toString());
}
}
}
代码示例来源:origin: org.dom4j/org.motechproject.org.dom4j
protected static boolean booleanValue(Attribute attribute) {
if (attribute == null) {
return false;
}
Object value = attribute.getData();
if (value == null) {
return false;
} else if (value instanceof Boolean) {
Boolean b = (Boolean) value;
return b.booleanValue();
} else {
return "true".equalsIgnoreCase(value.toString());
}
}
}
代码示例来源:origin: org.dom4j/com.springsource.org.dom4j
protected static boolean booleanValue(Attribute attribute) {
if (attribute == null) {
return false;
}
Object value = attribute.getData();
if (value == null) {
return false;
} else if (value instanceof Boolean) {
Boolean b = (Boolean) value;
return b.booleanValue();
} else {
return "true".equalsIgnoreCase(value.toString());
}
}
}
代码示例来源:origin: com.atlassian.plugins/atlassian-plugins-core
public Map<String, String> getParameters() {
return Collections.unmodifiableMap(getParamElements()
.collect(Collectors.toMap(param -> param.attribute("name").getData().toString(), Element::getText)));
}
代码示例来源:origin: dom4j/dom4j
private void validateLongAttribute(Element root) throws Exception {
Attribute attr = root.attribute("longAttribute");
Object attrData = attr.getData();
validateData("testLongAttribute", attrData, new Long(123));
System.out.println("retrieved attribute " + attrData);
}
代码示例来源:origin: org.nakedobjects.plugins/hibernate-hibernate
public void xtestOneToOneInverse() {
// system.addSpecification(BiDirectional.class.getName());
final PersistentNakedClasses classes = PersistentNakedClasses.buildPersistentNakedClasses(Boolean.TRUE);
final Nof2HbmXml nof2HbmXml = new Nof2HbmXml();
final Document doc = nof2HbmXml.createDocument(classes.getPersistentClass(OneToOne.class.getName()));
final Element manyToOne = doc.getRootElement().element("class").element("many-to-one");
assertEquals("name", "one", manyToOne.attribute("name").getData());
assertEquals("class", BiDirectional.class.getName(), manyToOne.attribute("class").getData());
assertEquals("unique", "true", manyToOne.attribute("unique").getData());
assertEquals("column", "FKone", manyToOne.attribute("column").getData());
}
代码示例来源:origin: org.nakedobjects.plugins/hibernate-hibernate
public void xtestManyToManyInverse() {
// system.addSpecification(BiDirectional.class.getName());
final PersistentNakedClasses classes = PersistentNakedClasses.buildPersistentNakedClasses(Boolean.TRUE);
final Nof2HbmXml nof2HbmXml = new Nof2HbmXml();
final Document doc = nof2HbmXml.createDocument(classes.getPersistentClass(ManyToMany.class.getName()));
final Element bag = doc.getRootElement().element("class").element("bag");
assertEquals("bag name", "many", bag.attribute("name").getData());
assertEquals("bag table", "BIDIRECTIONAL_MANYTOMANY", bag.attribute("table").getData());
assertEquals("bag inverse", "true", bag.attribute("inverse").getData());
assertEquals("key", "FKmanytomany", bag.element("key").attribute("column").getData());
final Element manyToMany = bag.element("many-to-many");
assertEquals("many class", BiDirectional.class.getName(), manyToMany.attribute("class").getData());
assertEquals("many column", "FKbidirectional", manyToMany.attribute("column").getData());
}
代码示例来源:origin: dom4j/dom4j
protected void testNodes(String xpath, Class type) {
List<Node> list = document.selectNodes(xpath);
assertTrue("Results are not empty", !list.isEmpty());
for (Node node : list) {
if (node instanceof Element) {
Element element = (Element) node;
testDataType(element, element.getData(), type);
} else if (node instanceof Attribute) {
Attribute attribute = (Attribute) node;
testDataType(attribute, attribute.getData(), type);
} else {
assertTrue("Did not find an attribute or element: " + node,
false);
}
}
}
代码示例来源:origin: dom4j/dom4j
@Test(expectedExceptions = IllegalArgumentException.class)
public void testAttributeWithNamespace() throws Exception {
QName personName = factory.createQName("person", "t", "urn://testing");
QName ageName = factory.createQName("age", "t", "urn://testing");
Element person = factory.createElement(personName);
person.addAttribute(ageName, "10");
Attribute age = person.attribute(ageName);
assertTrue("Created DatatypeAttribute not correct",
age instanceof DatatypeAttribute);
log("Found attribute: " + age);
Object data = age.getData();
Object expected = new BigInteger("10");
assertEquals("Data is correct type", BigInteger.class, data.getClass());
assertEquals("Set age correctly", expected, data);
age.setValue("32");
data = age.getData();
expected = new BigInteger("32");
assertEquals("Set age correctly", expected, data);
age.setValue("abc");
fail("Appeared to set an invalid value");
}
内容来源于网络,如有侵权,请联系作者删除!