本文整理汇总了Java中org.w3c.dom.Element.setTextContent方法的典型用法代码示例。如果您正苦于以下问题:Java Element.setTextContent方法的具体用法?Java Element.setTextContent怎么用?Java Element.setTextContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.w3c.dom.Element
的用法示例。
在下文中一共展示了Element.setTextContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toDOM
import org.w3c.dom.Element; //导入方法依赖的package包/类
private Element toDOM(Document doc, String tag, List<String> conceptIDs) {
Element result = doc.createElement(tag);
for (Token t : tokens) {
Element te = t.toDOM(doc, "t");
result.appendChild(te);
}
Element hte = headToken.toDOM(doc, "ht");
result.appendChild(hte);
if (head != null) {
Element he = head.toDOM(doc, "head");
result.appendChild(he);
}
for (Candidate mod : modifiers) {
Element me = mod.toDOM(doc, "mod");
result.appendChild(me);
}
for (String cid : conceptIDs) {
Element ce = doc.createElement("concept");
ce.setTextContent(cid);
result.appendChild(ce);
}
return result;
}
示例2: getServiceResult
import org.w3c.dom.Element; //导入方法依赖的package包/类
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
String projectName = request.getParameter("projectName");
Element root = document.getDocumentElement();
Element projectStatistic = document.createElement("statistics");
projectStatistic.setAttribute("project", projectName);
Project project = Engine.theApp.databaseObjectsManager.getOriginalProjectByName(projectName);
Map<String,String> mapStatsProject = ProjectUtils.getStatByProject(project);
if(mapStatsProject != null && mapStatsProject.size()>0) {
for(String key : mapStatsProject.keySet()) {
Element obj = document.createElement(key.replaceAll(" ", "_"));
obj.setTextContent(mapStatsProject.get(key));
projectStatistic.appendChild(obj);
}
}
root.appendChild(projectStatistic);
}
示例3: appendEmailCriterion
import org.w3c.dom.Element; //导入方法依赖的package包/类
private void appendEmailCriterion(Document doc, ChargingData chargingData,
Element analysisNode) {
Element emailCriterion = doc
.createElement(HeidelpayXMLTags.XML_ANALYSIS_CRITERION);
emailCriterion.setAttribute(HeidelpayXMLTags.XML_ATTRIBUTE_NAME,
HeidelpayXMLTags.XML_ANALYSIS_EMAIL);
if (chargingData.getEmail() != null) {
emailCriterion.setTextContent(chargingData.getEmail());
}
analysisNode.appendChild(emailCriterion);
}
示例4: patch
import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
public List<DavResource> patch(String url, Map<QName, String> setProps, List<QName> removeProps) throws IOException {
List<Element> setPropsElements = new ArrayList<>();
for (Map.Entry<QName, String> entry : setProps.entrySet()) {
Element element = SardineUtil.createElement(entry.getKey());
element.setTextContent(entry.getValue());
setPropsElements.add(element);
}
return this.patch(url, setPropsElements, removeProps);
}
示例5: saveToDom
import org.w3c.dom.Element; //导入方法依赖的package包/类
protected Element saveToDom(final Element element) throws FinalizationException {
super.saveToDom(element);
final Document document = element.getOwnerDocument();
element.setAttribute(VERSION_TAG_NAME, version.toString());
element.setAttribute(PLATFORMS_TAG_NAME,
StringUtils.asString(supportedPlatforms, StringUtils.SPACE));
element.setAttribute(STATUS_TAG_NAME, currentStatus.toString());
element.setAttribute(FEATURES_TAG_NAME,
StringUtils.asString(features, StringUtils.SPACE));
element.appendChild(XMLUtils.saveExtendedUrisList(
logicUris,
document.createElement(CONFIGURATION_LOGIC_TAG_NAME)));//NOI18N
element.appendChild(XMLUtils.saveExtendedUrisList(
dataUris,
document.createElement(INSTALLATION_DATA_TAG_NAME)));//NOI18N
final Element systemRequirementsElement =
document.createElement(SYSTEM_REQUIREMENTS_TAG_NAME);//NOI18N
final Element diskSpaceElement =
document.createElement(DISK_SPACE_TAG_NAME);//NOI18N
diskSpaceElement.setTextContent(Long.toString(requiredDiskSpace));
systemRequirementsElement.appendChild(diskSpaceElement);
element.appendChild(systemRequirementsElement);
if (dependencies.size() > 0) {
element.appendChild(XMLUtils.saveDependencies(
dependencies,
document.createElement(DEPENDENCIES_TAG_NAME)));//NOI18N
}
return element;
}
示例6: getServiceResult
import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
Element root = document.getDocumentElement();
Element message = document.createElement("message");
root.appendChild(message);
File storeDirectory = new File(Engine.USER_WORKSPACE_PATH, StoreFiles.STORE_DIRECTORY_NAME);
if (storeDirectory.exists()) {
FileUtils.deleteDirectory(storeDirectory);
message.setTextContent("The custom Store has correctly been deleted.");
}
else {
message.setTextContent("No custom Store has been uploaded.");
}
}
示例7: getServiceResult
import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
Element root = document.getDocumentElement();
Element method = document.createElement("method");
method.setTextContent(request.getMethod());
root.appendChild(method);
Element url = document.createElement("url");
url.setTextContent(request.getRequestURL().toString());
root.appendChild(url);
String queryString = request.getQueryString();
if (StringUtils.isNotEmpty(queryString)) {
Element query = document.createElement("query");
query.setTextContent(queryString);
root.appendChild(query);
}
Element headers = document.createElement("headers");
for (Enumeration<String> headerEnum = request.getHeaderNames(); headerEnum.hasMoreElements();) {
String headerName = headerEnum.nextElement();
for (Enumeration<String> valueEnum = request.getHeaders(headerName); valueEnum.hasMoreElements();) {
String headerValue = valueEnum.nextElement();
Element header = document.createElement("header");
header.setAttribute("name", headerName);
header.setTextContent(headerValue);
headers.appendChild(header);
}
}
root.appendChild(headers);
}
示例8: marshall
import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
public Node marshall(Document document) {
Element signatureValue = createThisElement(document);
Element tag = document.createElement("DSigValue");
tag.setTextContent(this.dsigValue);
signatureValue.appendChild(tag);
Element accumulatorValue = document.createElement("AccumulatorValue");
accumulatorValue.setTextContent(this.accumulatorValue);
signatureValue.appendChild(accumulatorValue);
return signatureValue;
}
示例9: getServiceResult
import org.w3c.dom.Element; //导入方法依赖的package包/类
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
Element root = document.getDocumentElement();
String projectName = request.getParameter("projectName");
final Set<String> allUndefinedSymbols = Engine.theApp.databaseObjectsManager.symbolsGetUndefined(projectName);
Element undefined_symbols = document.createElement("undefined_symbols");
if (allUndefinedSymbols != null) {
for (String undefinedSymbol : new TreeSet<String>(allUndefinedSymbols)) {
Element symbol = document.createElement("symbol");
symbol.setTextContent(undefinedSymbol);
undefined_symbols.appendChild(symbol);
}
}
root.appendChild(undefined_symbols);
}
示例10: marshall
import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
public Node marshall(Document document) {
Element simpleProof = createThisElement(document);
Element data = createElement(document, "Data");
data.setTextContent(proof);
simpleProof.appendChild(data);
return simpleProof;
}
示例11: writeXml
import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
public Node writeXml(Document document) throws Exception {
Element self = document.createElement(getClass().getSimpleName());
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("mode", mode.name().toLowerCase());
jsonObject.put("value", getSmartValue());
} catch (JSONException e) {
e.printStackTrace();
}
self.setTextContent(jsonObject.toString());
return self;
}
示例12: appendVatAmountCriterion
import org.w3c.dom.Element; //导入方法依赖的package包/类
private void appendVatAmountCriterion(Document doc,
ChargingData chargingData, Element analysisNode) {
Element vatAmountCriterion = doc
.createElement(HeidelpayXMLTags.XML_ANALYSIS_CRITERION);
vatAmountCriterion.setAttribute(HeidelpayXMLTags.XML_ATTRIBUTE_NAME,
HeidelpayXMLTags.XML_ANALYSIS_AMOUNT_VAT);
String vatAmountAsString = chargingData.getVatAmount() == null ? "null"
: chargingData.getVatAmount().toPlainString();
vatAmountCriterion.setTextContent(vatAmountAsString);
analysisNode.appendChild(vatAmountCriterion);
}
示例13: create
import org.w3c.dom.Element; //导入方法依赖的package包/类
private Element create( String tagName, String content ) {
Element child = doc.createElement( tagName );
child.setTextContent( content );
return child;
}
示例14: getServiceResult
import org.w3c.dom.Element; //导入方法依赖的package包/类
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
String cacheManagerFileType = "com.twinsoft.convertigo.engine.cache.FileCacheManager";
Element root = document.getDocumentElement();
Element cacheTypeElt= document.createElement("cacheType");
String cacheType=EnginePropertiesManager.getProperty(PropertyName.CACHE_MANAGER_CLASS);
cacheTypeElt.setTextContent(cacheType);
root.appendChild(cacheTypeElt);
if(!cacheType.equals(cacheManagerFileType)){
Properties dbCacheProp = new Properties();
String dbCachePropFileName = Engine.CONFIGURATION_PATH + DatabaseCacheManager.DB_PROP_FILE_NAME;
dbCacheProp.load(new FileInputStream(dbCachePropFileName.toString()));
String url,databaseType,serverName,port,databaseName;
url=dbCacheProp.getProperty("jdbc.url");
databaseType=url.replaceFirst("://(.*)", "").replaceAll("(.*):", "");
url=url.replaceFirst("(.*)://", "");
serverName=url.replaceFirst("\\:(.*)", "");
url=url.replaceFirst("(.*)\\:", "");
port=url.replaceFirst("/(.*)", "");
databaseName=url.replaceFirst("(.*)/", "");
Element databaseTypeElt= document.createElement("databaseType");
databaseTypeElt.setTextContent(databaseType);
root.appendChild(databaseTypeElt);
Element serverNameElt= document.createElement("serverName");
serverNameElt.setTextContent(serverName);
root.appendChild(serverNameElt);
Element portElt= document.createElement("port");
portElt.setTextContent(port);
root.appendChild(portElt);
Element databaseNameElt= document.createElement("databaseName");
databaseNameElt.setTextContent(databaseName);
root.appendChild(databaseNameElt);
Element name= document.createElement("userName");
name.setTextContent(dbCacheProp.getProperty("jdbc.user.name"));
root.appendChild(name);
Element password= document.createElement("userPassword");
password.setTextContent(Crypto2.decodeFromHexString(dbCacheProp.getProperty("jdbc.user.password")));
root.appendChild(password);
}
}
示例15: forceImpliesViaConstraint
import org.w3c.dom.Element; //导入方法依赖的package包/类
private static void forceImpliesViaConstraint(Element parent, Document doc, Optionable option1, Optionable option2) {
Element e = doc.createElement("constraint");
e.setTextContent(generateName(option1) + IMPLIES + generateName(option2));
parent.appendChild(e);
}