当前位置: 首页>>代码示例>>Java>>正文


Java StringEscapeUtils.escapeXml方法代码示例

本文整理汇总了Java中org.apache.commons.lang.StringEscapeUtils.escapeXml方法的典型用法代码示例。如果您正苦于以下问题:Java StringEscapeUtils.escapeXml方法的具体用法?Java StringEscapeUtils.escapeXml怎么用?Java StringEscapeUtils.escapeXml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.lang.StringEscapeUtils的用法示例。


在下文中一共展示了StringEscapeUtils.escapeXml方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getContent

import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * @see ch.dvbern.lib.doctemplate.common.BasicMergeElement#getContent(ch.dvbern.lib.doctemplate.common.MergeContext,
 *      ch.dvbern.lib.doctemplate.common.MergeSource, java.io.OutputStream)
 */
@Override
public void getContent(MergeContext ctx, MergeSource mergeSource, OutputStream output) throws DocTemplateException {

	// Format-Suffix aus key extrahieren
	String keyWithoutFormatSuffix = this.key, formatSuffix = null;
	int i = this.key.indexOf(FORMAT_SUFFIX);
	if (i > 0) {
		formatSuffix = this.key.substring(i + FORMAT_SUFFIX.length());
		keyWithoutFormatSuffix = this.key.substring(0, i);
	}

	Object data = mergeSource.getData(ctx, keyWithoutFormatSuffix);
	if (data instanceof Image) {
		addImage((T) data, formatSuffix, output);
	} else if (data != null) {
		String dataAsString = FormatHelper.getDataAsString(data, StringUtils.isEmpty(formatSuffix) ? getDefaultFormatter(data) : formatSuffix);
		dataAsString = StringEscapeUtils.escapeXml(dataAsString);
		writeText(output, dataAsString);
	} else {
		log.warn(this.name + ": no template source with key " + this.key);
	}
}
 
开发者ID:dvbern,项目名称:doctemplate,代码行数:27,代码来源:XmlBasedFieldMergeElement.java

示例2: escapeXML

import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
/** Replaces angle brackets by html entities. */
public static String escapeXML(String string) {
	if (string == null) {
		return "null";
	}
	return StringEscapeUtils.escapeXml(string);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:Tools.java

示例3: getCDataXml

import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
public static String getCDataXml(String s) {
	return StringEscapeUtils.escapeXml(getCDataText(s));
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:4,代码来源:XMLUtils.java

示例4: generateXsdRequestData

import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
@Override
public String generateXsdRequestData() throws Exception {
	String prefix = getXsdTypePrefix();
   	
   	String xsdRequestData = null;
   	RequestableVariable variable = null;
   	xsdRequestData = 	"  <xsd:complexType name=\""+ prefix + getName() + "RequestData\">\n";
	//xsdRequestData += 	"    <xsd:annotation>\n";
	//xsdRequestData += 	"      <xsd:documentation>"+ XMLUtils.getCDataXml(getComment()) +"</xsd:documentation>\n";
	//xsdRequestData += 	"    </xsd:annotation>\n";
   	xsdRequestData +=	"    <xsd:sequence>\n";
	for (int i=0; i<numberOfVariables(); i++) {
		variable = (RequestableVariable)getVariable(i);
		if (variable.isWsdl()) {
			if (variable.isMultiValued()) {
				xsdRequestData += "      <xsd:element minOccurs=\"1\" maxOccurs=\"1\" name=\""+variable.getName()+"\" >\n";
				xsdRequestData += "        <xsd:annotation>\n";
				xsdRequestData += "          <xsd:documentation>"+ XMLUtils.getCDataXml(variable.getComment()) +"</xsd:documentation>\n";
				xsdRequestData += "          <xsd:appinfo>"+ StringEscapeUtils.escapeXml(variable.getDescription()) +"</xsd:appinfo>\n";
				xsdRequestData += "        </xsd:annotation>\n";
				xsdRequestData += "        <xsd:complexType>\n";
				xsdRequestData += "          <xsd:sequence>\n";
				xsdRequestData += "            <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" name=\"item\" type=\""+variable.getSchemaType()+"\" />\n";
				xsdRequestData += "          </xsd:sequence>\n";
				xsdRequestData += "        </xsd:complexType>\n";
				xsdRequestData += "      </xsd:element>\n";
			}
			else {
				xsdRequestData += "      <xsd:element minOccurs=\"1\" maxOccurs=\"1\" name=\""+variable.getName()+"\" type=\""+variable.getSchemaType()+"\">\n";
				xsdRequestData += "        <xsd:annotation>\n";
				xsdRequestData += "          <xsd:documentation>"+ XMLUtils.getCDataXml(variable.getComment()) +"</xsd:documentation>\n";
				xsdRequestData += "          <xsd:appinfo>"+ StringEscapeUtils.escapeXml(variable.getDescription()) +"</xsd:appinfo>\n";
				xsdRequestData += "        </xsd:annotation>\n";
				xsdRequestData += "      </xsd:element>\n";
			}
		}
	}
	xsdRequestData +=	"    </xsd:sequence>\n";
	xsdRequestData +=	"  </xsd:complexType>\n";
   	return xsdRequestData;
   }
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:42,代码来源:TransactionWithVariables.java

示例5: getNotifications

import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
private void getNotifications(Integer userId, HttpServletRequest request, HttpServletResponse response)
    throws IOException {
Document doc = NotificationServlet.docBuilder.newDocument();
Element notificationsElement = doc.createElement("Notifications");
doc.appendChild(notificationsElement);

Long lessonId = WebUtil.readLongParam(request, CentralConstants.PARAM_LESSON_ID, true);
Integer limit = WebUtil.readIntParam(request, "limit", true);
Integer offset = WebUtil.readIntParam(request, "offset", true);
Boolean pendingOnly = WebUtil.readBooleanParam(request, "pendingOnly", true);

List<Subscription> subscriptions = NotificationServlet.eventNotificationService
	.getNotificationSubscriptions(lessonId, userId, pendingOnly, limit, offset);
for (Subscription subscription : subscriptions) {
    Element notificationElement = doc.createElement("Notification");

    notificationElement.setAttribute("id", subscription.getUid().toString());

    Boolean pending = !DeliveryMethodNotification.LAST_OPERATION_SEEN
	    .equals(subscription.getLastOperationMessage());
    notificationElement.setAttribute("pending", pending.toString());

    Long notificationLessonId = subscription.getEvent().getEventSessionId();
    if (notificationLessonId != null) {
	notificationElement.setAttribute("lessonId", notificationLessonId.toString());
    }

    String message = subscription.getEvent().getMessage();
    Matcher matcher = NotificationServlet.anchorPattern.matcher(message);
    if (matcher.find()) {
	String href = StringEscapeUtils.escapeXml(matcher.group(2));
	notificationElement.setAttribute("href", href);
	message = matcher.group(3);
    }
    notificationElement.appendChild(doc.createCDATASection(message));

    notificationsElement.appendChild(notificationElement);
}

response.setContentType("text/xml");
response.setCharacterEncoding("UTF-8");

DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation();
LSSerializer lsSerializer = domImplementation.createLSSerializer();
LSOutput lsOutput = domImplementation.createLSOutput();
lsOutput.setEncoding("UTF-8");
lsOutput.setByteStream(response.getOutputStream());
lsSerializer.write(doc, lsOutput);
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:50,代码来源:NotificationServlet.java

示例6: xmlEscape

import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Xml 转码.
 */
public static String xmlEscape(String xml) {
    return StringEscapeUtils.escapeXml(xml);
}
 
开发者ID:dragon-yuan,项目名称:Ins_fb_pictureSpider_WEB,代码行数:7,代码来源:EncodeUtils.java

示例7: xmlEscape

import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
/**
 * Xml 转码.
 */
public static String xmlEscape(String xml) {
	return StringEscapeUtils.escapeXml(xml);
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:7,代码来源:EncodeUtils.java

示例8: unescape

import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
protected String unescape(String str){
	if(StringUtils.isEmpty(str))return str;
	str=StringEscapeUtils.escapeXml(str);
	return StringEscapeUtils.unescapeXml(str);
}
 
开发者ID:youseries,项目名称:uflo,代码行数:6,代码来源:SequenceFlowParser.java

示例9: escapeXml

import org.apache.commons.lang.StringEscapeUtils; //导入方法依赖的package包/类
/**
 *  Escapes the characters in a String using XML entities.
 *
 * @param  xml  The String to escape, may be null
 * @return      A new escaped String, null if null string input
 */
public final static String escapeXml(String xml) {
	return StringEscapeUtils.escapeXml(xml);
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:10,代码来源:XMLUtils.java


注:本文中的org.apache.commons.lang.StringEscapeUtils.escapeXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。