List of usage examples for org.apache.commons.text StringEscapeUtils escapeXml10
public static String escapeXml10(final String input)
Escapes the characters in a String using XML entities.
For example: "bread" & "butter" => "bread" & "butter" .
From source file:com.nridge.core.base.io.xml.IOXML.java
/** * Writes an XML tag attribute (name/value) while ensuring the characters * are properly escaped./*from www. j av a 2 s . c o m*/ * * @param aPW Print writer output stream. * @param aName Attribute name. * @param aValue Attribute value. * * @throws IOException I/O related exception. */ public static void writeAttrNameValue(PrintWriter aPW, String aName, String aValue) throws IOException { if (StringUtils.isNotEmpty(aValue)) aPW.printf(" %s=\"%s\"", StringEscapeUtils.escapeXml10(aName), StringEscapeUtils.escapeXml10(aValue)); }
From source file:com.nridge.core.base.std.XMLUtl.java
public static String escapeString(String aString) { return StringEscapeUtils.escapeXml10(aString); }
From source file:com.nridge.core.base.io.xml.IOXML.java
/** * Writes an XML tag attribute (name/value) while ensuring the characters * are properly escaped.//from ww w . j a v a2 s . c om * * @param aPW Print writer output stream. * @param aName Attribute name. * @param aValue Attribute value. * * @throws IOException I/O related exception. */ public static void writeAttrNameValue(PrintWriter aPW, String aName, char aValue) throws IOException { aPW.printf(" %s=\"%c\"", StringEscapeUtils.escapeXml10(aName), aValue); }
From source file:de.micromata.genome.util.xml.xmlbuilder.AppendableXmlRenderer.java
@Override public XmlRenderer text(String code) throws IOException { appender.append(StringEscapeUtils.escapeXml10(code)); return this; }
From source file:com.nridge.core.ds.io.xml.SmartGWTXML.java
private void saveRecord(PrintWriter aPW, DataBag aBag) { aPW.printf("<record>%n"); for (DataField dataField : aBag.getFields()) { aPW.printf("<%s>%s</%s>", dataField.getName(), StringEscapeUtils.escapeXml10(dataField.collapse()), dataField.getName());// www .j av a2s .c o m } aPW.printf("</record>%n"); }
From source file:com.nridge.core.base.io.xml.IOXML.java
/** * Writes an XML tag attribute (name/value) while ensuring the characters * are properly escaped.//from ww w.j ava2 s . c om * * @param aPW Print writer output stream. * @param aName Attribute name. * @param aValue Attribute value. * * @throws IOException I/O related exception. */ public static void writeAttrNameValue(PrintWriter aPW, String aName, int aValue) throws IOException { aPW.printf(" %s=\"%d\"", StringEscapeUtils.escapeXml10(aName), aValue); }
From source file:com.nridge.core.base.io.xml.RangeXML.java
public void saveValue(PrintWriter aPW, FieldRange aFieldRange) throws IOException { if (aFieldRange.getType() == Field.Type.Text) { String singleString = StrUtl.collapseToSingle(aFieldRange.getItems(), aFieldRange.getDelimiterChar()); aPW.printf(">%s</%s>%n", StringEscapeUtils.escapeXml10(singleString), RANGE_NODE_NAME); } else {/*from w w w .j a v a 2s .co m*/ IOXML.writeAttrNameValue(aPW, "min", aFieldRange.getMinString()); IOXML.writeAttrNameValue(aPW, "max", aFieldRange.getMaxString()); aPW.printf("/>%n"); } }
From source file:com.nridge.core.base.io.xml.IOXML.java
/** * Writes an XML tag attribute (name/value) while ensuring the characters * are properly escaped.//from ww w. j ava2s . co m * * @param aPW Print writer output stream. * @param aName Attribute name. * @param aValue Attribute value. * * @throws IOException I/O related exception. */ public static void writeAttrNameValue(PrintWriter aPW, String aName, long aValue) throws IOException { aPW.printf(" %s=\"%d\"", StringEscapeUtils.escapeXml10(aName), aValue); }
From source file:com.nridge.core.base.io.xml.IOXML.java
/** * Writes an XML tag attribute (name/value) while ensuring the characters * are properly escaped./*w w w .j av a 2s.c o m*/ * * @param aPW Print writer output stream. * @param aName Attribute name. * @param aValue Attribute value. * * @throws IOException I/O related exception. */ public static void writeAttrNameValue(PrintWriter aPW, String aName, boolean aValue) throws IOException { aPW.printf(" %s=\"%s\"", StringEscapeUtils.escapeXml10(aName), StrUtl.booleanToString(aValue)); }
From source file:com.softwareaggov.messaging.simplesoapjms.client.web.SendSoapCall.java
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { resp.setContentType("text/html"); PrintWriter out = resp.getWriter(); out.write("<h1>" + req.getContextPath() + " - Sending SOAP Call</h1>"); try {//from ww w. jav a 2 s . co m String callType = req.getParameter("calltype"); SoapClientLocal soapJmsService = null; if (null != callType) { if ("oneway".equals(callType.toLowerCase())) soapJmsService = soapHttpClientOneWayService; else if ("twoway".equals(callType.toLowerCase())) soapJmsService = soapHttpClientTwoWayService; else throw new IllegalArgumentException("call type [" + callType + "] not supported."); } else { throw new IllegalArgumentException("call type [null] not supported."); } if (null == soapJmsService) throw new IllegalArgumentException( "soapJmsService is null...should not be...check code or configs"); String response = soapJmsService.callWS(); String responseToDisplay = ""; if (null != response) { if (response.toLowerCase().startsWith("<?xml")) { responseToDisplay = StringEscapeUtils.escapeXml10(response); } else { responseToDisplay = response; } } else { responseToDisplay = "null"; } out.write("<p><b>messages sent successfully</b></p>"); out.write(String.format("<div><p>Response:</p><p>%s</p></div>", responseToDisplay)); out.close(); } catch (Throwable exc) { log.error("Error Occurred", exc); throw new ServletException(exc); } }