本文整理了Java中org.dom4j.Element.elementTextTrim()
方法的一些代码示例,展示了Element.elementTextTrim()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.elementTextTrim()
方法的具体详情如下:
包路径:org.dom4j.Element
类名称:Element
方法名:elementTextTrim
暂无
代码示例来源:origin: igniterealtime/Openfire
private static String getClassName( String type, Document webXml, String typeName )
{
String className = null;
final List<Element> elements = webXml.getRootElement().elements( type ); // all elements of 'type' (filter or servlet).
for ( final Element element : elements )
{
final String name = element.elementTextTrim( type + "-name" );
if ( typeName.equals( name ) )
{
className = element.elementTextTrim( type + "-class" );
break;
}
}
if (className == null || className.isEmpty() )
{
return null;
}
return className;
}
代码示例来源:origin: igniterealtime/Openfire
private static List<String> getNames( String type, Document webXml )
{
final List<String> result = new ArrayList<>();
final List<Element> elements = webXml.getRootElement().elements( type ); // all elements of 'type' (filter or servlet).
for ( final Element element : elements )
{
final String name = element.elementTextTrim( type + "-name" );
if ( name != null && !name.isEmpty() )
{
result.add( name );
}
}
return result;
}
代码示例来源:origin: igniterealtime/Openfire
private static Map<String, String> getInitParams( String type, Document webXml, String typeName )
{
final Map<String, String> result = new HashMap<>();
final List<Element> elements = webXml.getRootElement().elements( type ); // all elements of 'type' (filter or servlet).
for ( final Element element : elements )
{
final String name = element.elementTextTrim( type + "-name" );
if ( typeName.equals( name ) )
{
final List<Element> initParamElements = element.elements( "init-param" );
for ( final Element initParamElement : initParamElements )
{
final String pName = initParamElement.elementTextTrim( "param-name" );
final String pValue = initParamElement.elementTextTrim( "param-value" );
if ( pName == null || pName.isEmpty() ) {
Log.warn( "Unable to add init-param that has no name" );
}
else
{
result.put( pName, pValue );
}
}
}
}
return result;
}
代码示例来源:origin: igniterealtime/Openfire
name = element.elementTextTrim("GIVEN");
email = element.elementTextTrim("USERID");
if (element.element("HOME") != null) {
if (element.element("STREET") != null) {
homeStreet = element.elementTextTrim("STREET");
homeCity = element.elementTextTrim("LOCALITY");
homeState = element.elementTextTrim("REGION");
homeZip = element.elementTextTrim("PCODE");
homeCountry = element.elementTextTrim("CTRY");
businessStreet = element.elementTextTrim("STREET");
businessCity = element.elementTextTrim("LOCALITY");
businessState = element.elementTextTrim("REGION");
businessZip = element.elementTextTrim("PCODE");
businessCountry = element.elementTextTrim("CTRY");
if (element.element("HOME") != null) {
if (element.element("VOICE") != null) {
homePhone = element.elementTextTrim("NUMBER");
代码示例来源:origin: igniterealtime/Openfire
for ( final Element element : elements )
final String name = element.elementTextTrim( type + "-name" );
if ( typeName.equals( name ) )
代码示例来源:origin: igniterealtime/Openfire
public void parse(Element formElement) {
variable = formElement.attributeValue("var");
setLabel(formElement.attributeValue("label"));
setType(formElement.attributeValue("type"));
Element descElement = formElement.element("desc");
if (descElement != null) {
setDescription(descElement.getTextTrim());
}
if (formElement.element("required") != null) {
setRequired(true);
}
Iterator valueElements = formElement.elementIterator("value");
while (valueElements.hasNext()) {
addValue(((Element)valueElements.next()).getTextTrim());
}
Iterator optionElements = formElement.elementIterator("option");
Element optionElement;
while (optionElements.hasNext()) {
optionElement = (Element)optionElements.next();
addOption(optionElement.attributeValue("label"), optionElement.elementTextTrim("value"));
}
}
代码示例来源:origin: igniterealtime/Openfire
@Override
public String getLastPresenceStatus(User user) {
String username = user.getUsername();
String presenceStatus = null;
String presenceXML = offlinePresenceCache.get(username);
if (presenceXML == null) {
loadOfflinePresence(username);
}
presenceXML = offlinePresenceCache.get(username);
if (presenceXML != null) {
// If the cached answer is no data, return null.
if (presenceXML.equals(NULL_STRING)) {
return null;
}
// Otherwise, parse out the status from the XML.
try {
// Parse the element
Document element = DocumentHelper.parseText(presenceXML);
presenceStatus = element.getRootElement().elementTextTrim("status");
}
catch (DocumentException e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
}
}
return presenceStatus;
}
代码示例来源:origin: igniterealtime/Openfire
item.elementTextTrim("reason"),
senderRole));
} else if ("visitor".equals(target)) {
presences.addAll(room.addOutcast(jid, item.elementTextTrim("reason"), senderRole));
} else if ("none".equals(target)) {
if (hasAffiliation) {
item.elementTextTrim("reason")));
代码示例来源:origin: igniterealtime/Openfire
server.getChatRoom(group).sendInvitationRejection(
new JID(info.attributeValue("to")),
info.elementTextTrim("reason"),
packet.getFrom());
info.elementTextTrim("reason"), role, extensions);
info.elementTextTrim("reason"), packet.getFrom());
代码示例来源:origin: igniterealtime/Openfire
String sid = childElement.attributeValue("sid");
JID from = packet.getFrom();
JID to = new JID(childElement.elementTextTrim("activate"));
代码示例来源:origin: igniterealtime/Openfire
alternateJID = new JID(jid);
room.destroyRoom(alternateJID, destroyElement.elementTextTrim("reason"));
代码示例来源:origin: igniterealtime/Openfire
password = mucInfo.elementTextTrim("password");
if (mucInfo.element("history") != null) {
historyRequest = new HistoryRequest(mucInfo);
代码示例来源:origin: igniterealtime/Openfire
Element child = reply.setChildElement("bind", "urn:ietf:params:xml:ns:xmpp-bind");
String resource = packet.getChildElement().elementTextTrim("resource");
if (resource == null || resource.length() == 0) {
代码示例来源:origin: org.igniterealtime/tinder
/**
* Returns the value of the option.
*
* @return the value of the option.
*/
public String getValue() {
return element.elementTextTrim("value");
}
}
代码示例来源:origin: org.igniterealtime/tinder
/**
* Returns a description that provides extra clarification about the question. This information
* could be presented to the user either in tool-tip, help button, or as a section of text
* before the question.<p>
* <p/>
* If the question is of type FIXED then the description should remain empty.
*
* @return description that provides extra clarification about the question.
*/
public String getDescription() {
return element.elementTextTrim("desc");
}
代码示例来源:origin: org.igniterealtime/tinder
/**
* Returns the description of the data form. It is similar to the title on a web page or an X
* window. You can put a <title/> on either a form to fill out, or a set of data results.
*
* @return description of the data.
*/
public String getTitle() {
return element.elementTextTrim("title");
}
代码示例来源:origin: org.jboss.as/jboss-as-ee-deployment
private void init(Document document) {
Element root = document.getRootElement();
deploymentName = root.elementTextTrim("deployment-name");
Iterator it = root.elementIterator("deployment-entry");
while (it.hasNext()) {
Element element = (Element) it.next();
String archiveName = element.elementTextTrim("archive-name");
String descriptorName = element.elementTextTrim("descriptor-name");
addEntry(archiveName, descriptorName);
}
}
代码示例来源:origin: javanettasks/javanettasks
/**
* Gets the priority of this issue.
*/
public Priority getPriority() {
return Priority.valueOf(rawData.elementTextTrim("priority"));
}
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
public String elementTextTrim(String name) {
return target().elementTextTrim( name );
}
代码示例来源:origin: theonedev/onedev
private void migrate18(File dataDir, Stack<Integer> versions) {
for (File file: dataDir.listFiles()) {
if (file.getName().startsWith("Settings.xml")) {
VersionedDocument dom = VersionedDocument.fromFile(file);
for (Element element: dom.getRootElement().elements()) {
if (element.elementTextTrim("key").equals("LICENSE"))
element.detach();
}
dom.writeToFile(file, false);
}
}
}
内容来源于网络,如有侵权,请联系作者删除!