Here you can find the source of sanitizeXML(String xml)
Parameter | Description |
---|---|
xml | a parameter |
public static String sanitizeXML(String xml)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w ww .j a v a 2 s . c o m * Remove all unnecessary white spaces, tabs and line breaks from XML string. * TODO: Would be better to use a XSD with setIgnoringElementContentWhitespace attribute true * * @param xml * @return */ public static String sanitizeXML(String xml) { return xml.replace("\n", "").replace("\r", "").replace("\t", "").replaceAll(">\\s+<", "><").trim(); } }