Representing an XML file in a html page

时间:2016-07-11 21:32:45

标签: java xml

Using Java, How do you take an XML file and output it to a html page? This is so I can then highlight certain lines in the webpage.

1 个答案:

答案 0 :(得分:0)

You can transform XML using XSLT. XSLT is available as an app or in xml editors but you can also use it within Java. Either way you'll want to create an XSLT stylesheet that describes the transformation. What you can do is save the xml file and create a style sheet that can be run from an xslt application or editor. Once your html looks good incorporate the stylesheet into a Java program. See https://docs.oracle.com/javase/tutorial/jaxp/xslt/transformingXML.html for more info on getting started.