/** * Changes content from CSV to xml/html.<p> * * The method does not use DOM4J, because iso-8859-1 code ist not transformed correctly. * * @param cms the cms object * @param xsltFile the XSLT transformation file * @param csvContent the csv content to transform * @param delimiter delimiter used to separate csv fields * * @return the transformed xml * * @throws CmsXmlException if something goes wrong * @throws CmsException if something goes wrong */ public static String transformCsvContent(CmsObject cms, String xsltFile, String csvContent, String delimiter) throws CmsException, CmsXmlException { String xmlContent = ""; try { xmlContent = getTableHtml(csvContent, delimiter); } catch (IOException e) { throw new CmsXmlException(Messages.get().container(Messages.ERR_CSV_XML_TRANSFORMATION_FAILED_0)); } // if xslt file parameter is set, transform the raw html and set the css stylesheet property // of the converted file to that of the stylesheet if (xsltFile != null) { xmlContent = transformXmlContent(cms, xsltFile, xmlContent); } return xmlContent; }
/** * Changes content from CSV to xml/html.<p> * * The method does not use DOM4J, because iso-8859-1 code ist not transformed correctly. * * @param cms the cms object * @param xsltFile the XSLT transformation file * @param csvContent the csv content to transform * @param delimiter delimiter used to separate csv fields * * @return the transformed xml * * @throws CmsXmlException if something goes wrong * @throws CmsException if something goes wrong */ public static String transformCsvContent(CmsObject cms, String xsltFile, String csvContent, String delimiter) throws CmsException, CmsXmlException { String xmlContent = ""; try { xmlContent = getTableHtml(csvContent, delimiter); } catch (IOException e) { throw new CmsXmlException(Messages.get().container(Messages.ERR_CSV_XML_TRANSFORMATION_FAILED_0)); } // if xslt file parameter is set, transform the raw html and set the css stylesheet property // of the converted file to that of the stylesheet if (xsltFile != null) { xmlContent = transformXmlContent(cms, xsltFile, xmlContent); } return xmlContent; }
String transformedXmlContent = CmsXsltUtil.transformXmlContent(cmsObject, xsltFile, fileXmlContent); transformedXmlContent = "<?xml version=\"1.0\" encoding=\"".concat(encodingType).concat("\"?>").concat( transformedXmlContent);