當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。