大家好,我需要在Java中使用XSLT将HTML转换为XML。我已经使用Java中的XSLT将XML转换为HTML。下面是我用于进行转换的代码:
import javax.xml.transform.*;
import java.net.*;
import java.io.*;
public class HowToXSLT {
public static void main(String[] args) {
try {
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer =
tFactory.newTransformer
(new javax.xml.transform.stream.StreamSource
("howto.xsl"));
transformer.transform
(new javax.xml.transform.stream.StreamSource
("howto.xml"),
new javax.xml.transform.stream.StreamResult
( new FileOutputStream("howto.html")));
}
catch (Exception e) {
e.printStackTrace( );
}
}
}
但我不知道将html转换为xml的相反过程是什么?是否有可用的jar文件来完成此操作?请帮助我...