• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

.Xls file for xml to html conversion

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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( );
}
}
}
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic