• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

.Xls file for xml to html conversion

 
S Ag
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to convert this xml file to a html file, can some one help me in writting the .xsl file required for conversion.

my xml file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<pmd version="4.2.2" timestamp="2011-06-02T15:23:33.822">
<file name="a.java">
<violation beginline="745" endline="768" begincolumn="17" endcolumn="17" rule="CollapsibleIfStatements" ruleset="Basic Rules" package="xyz" class="myclass.java" method="getSu" priority="3">
These nested if statements could be combined
</violation>
<violation beginline="880" endline="893" begincolumn="17" endcolumn="17" rule="CollapsibleIfStatements" ruleset="Basic Rules" package="xyz" class="myclass.java" method="getSur" priority="3">
These nested if statements could be combined
</violation>
</file>
</pmd>


Java Code for conversion is:

import javax.xml.transform.*;
import java.net.*;
import java.io.*;

public class Converter {
public static void main(String[] args) {
try {

TransformerFactory tFactory = TransformerFactory.newInstance();

Transformer transformer =
tFactory.newTransformer
(new javax.xml.transform.stream.StreamSource
("pmd.xsl"));

transformer.transform
(new javax.xml.transform.stream.StreamSource
("pmd.xml"),
new javax.xml.transform.stream.StreamResult
( new FileOutputStream("pmd.html")));
}
catch (Exception e) {
e.printStackTrace( );
}
}
}
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seeing the Java code is not particularly useful; seeing the XSL code you have, and reading how it does not yet do what you need done, would be.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic