A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
Win a copy of
The Mikado Method
this week in the
Agile and other Processes
forum!
JavaRanch
»
Java Forums
»
Engineering
»
XML and Related Technologies
Author
.Xls file for xml to html conversion
S Ag
Greenhorn
Joined: Jun 03, 2011
Posts: 1
posted
Jun 03, 2011 01:45:57
0
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
Marshal
Joined: Mar 22, 2005
Posts: 35241
7
posted
Jun 03, 2011 05:50:48
0
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.
Android apps
–
ImageJ plugins
–
Java web charts
I agree. Here's the link:
http://ej-technologies/jprofiler
- if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
subject: .Xls file for xml to html conversion
Similar Threads
Ruleset not found error while customizing PMD.
What is the following XSLT program doing ?
capturing inividaul elements in the xml file
PMD tool
Transformation Problem For Arabic/French Character : HTML to XML
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter