Subversion Repositories bacoAlunos

Compare Revisions

Ignore whitespace Rev 1310 → Rev 1312

/branches/v3/impl/src/java/pt/estgp/estgweb/utils/Dom4jUtil.java
183,8 → 183,22
 
public static void write(Document document,Writer writerStream) throws IOException
{
write(document,writerStream,false);
}
public static void write(Document document,Writer writerStream,boolean omitXmlDecl) throws IOException
{
 
// lets write to a file
XMLWriter writer = new XMLWriter(writerStream);
XMLWriter writer;
if(omitXmlDecl)
{
OutputFormat format = new OutputFormat();
format.setSuppressDeclaration(true);
writer = new XMLWriter(writerStream,format);
}
else
writer = new XMLWriter(writerStream);
 
writer.write( document );
writer.close();
}
211,8 → 225,13
public static String styleDocument(Document document,String stylesheet) throws Exception {
return styleDocument(document,stylesheet, (Map<String,Object>) null);
}
public static String styleDocument(Document document,String stylesheet, Map<String,Object> parameters) throws Exception {
public static String styleDocument(Document document,String stylesheet, Map<String,Object> parameters) throws Exception
{
return styleDocument( document, stylesheet, parameters,false);
}
 
public static String styleDocument(Document document,String stylesheet, Map<String,Object> parameters,boolean omitXmlDecl) throws Exception {
 
Transformer transformer = getTransformerFromSystem(stylesheet);
if(parameters != null)
{
228,7 → 247,7
// return the transformed document
Document transformedDoc = result.getDocument();
StringWriter writer = new StringWriter();
write(transformedDoc,writer);
write(transformedDoc,writer,omitXmlDecl);
return writer.toString();
}
 
256,7 → 275,9
 
private static Transformer getTransformerFromSystem(String xsltFile) throws TransformerConfigurationException, IOException
{
Templates tpl = templates.get(xsltFile);
Templates tpl = null;
if(Globals.USE_XSL_CACHE)
tpl = templates.get(xsltFile);
if (tpl==null)
{
String path = Globals.CLASSES_ABSOLUTE_PATH + xsltFile;