public static String parseStringToPrettyfiedString(String ugly) { ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(ugly.getBytes()); XMLPrettyPrinter printer = new XMLPrettyPrinter(byteArrayInputStream); return printer.xmlFormat(); }
BusinessOwnerProperty businessOwnerProperties = businessOwnerPropertiesList.get(i); String propertyId = businessOwnerProperties.getPropertyId(); if(!StringUtils.isEmpty(propertyId)) { statementToInsertRecordTwo.setInt(1, businessOwner.getBusinessOwnerId()); statementToInsertRecordTwo.setString(2, propertyId);
public String getProcessModel(String processId) throws Exception { String tRawXML = deploymentServiceStub.getProcessModel(processId); tRawXML = tRawXML.replaceAll("\n|\\r|\\f|\\t", ""); tRawXML = tRawXML.replaceAll("> +<", "><"); InputStream xmlIn = new ByteArrayInputStream(tRawXML.getBytes()); XMLPrettyPrinter xmlPrettyPrinter = new XMLPrettyPrinter(xmlIn); tRawXML = xmlPrettyPrinter.xmlFormat().replaceAll("<", "<").replaceAll(">", ">"); return tRawXML; }
BusinessOwnerProperty businessOwnerProperties = businessOwnerPropertiesList.get(i); String propertyId = businessOwnerProperties.getPropertyId(); if(!StringUtils.isEmpty(propertyId)) { statementToInsertBusinessOwnerDetails.setInt(1, businessOwnerId); statementToInsertBusinessOwnerDetails.setString(2, propertyId);
public String getProcessModel(String processId) throws Exception { String tRawXML = deploymentServiceStub.getProcessModel(processId); tRawXML = tRawXML.replaceAll("\n|\\r|\\f|\\t", ""); tRawXML = tRawXML.replaceAll("> +<", "><"); InputStream xmlIn = new ByteArrayInputStream(tRawXML.getBytes()); XMLPrettyPrinter xmlPrettyPrinter = new XMLPrettyPrinter(xmlIn); tRawXML = xmlPrettyPrinter.xmlFormat().replaceAll("<", "<").replaceAll(">", ">"); return tRawXML; }
/** * Prettify a given XML string */ public static String prettifyXML(String xmlContent) { Element element = stringToElement(xmlContent); if (element == null) { return ""; } removeWhitespaceInMixedContentElements(element); xmlContent = elementToString(element); ByteArrayInputStream byteIn = new ByteArrayInputStream(xmlContent.getBytes()); XMLPrettyPrinter prettyPrinter = new XMLPrettyPrinter(byteIn); return prettyPrinter.xmlFormat().trim(); }
/** * Prettify a given XML string */ public static String prettifyXML(String xmlContent) { Element element = DataSourceUtils.stringToElement(xmlContent); if (element == null) { throw new RuntimeException("Error in converting string to XML: " + xmlContent); } removeWhitespaceInMixedContentElements(element); xmlContent = DataSourceUtils.elementToString(element); ByteArrayInputStream byteIn = new ByteArrayInputStream(xmlContent.getBytes()); XMLPrettyPrinter prettyPrinter = new XMLPrettyPrinter(byteIn); return prettyPrinter.xmlFormat().trim(); }