Murray,
Not sure if this will help get you started but here is a simple
transform using JAXP to both parse and serialize the resultant
Document object.
Running it agains the file shown below might give you some insight
<html>
<style>a < b</style>
</html>
I think you will find that JAXP is NOT placing the contents of <style>
inside a CDATA tag - although this can be done as an option using
another of the OutputKeys proeprties.
hope this helps
Dave Flanagan
###############################
import java.io.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.OutputKeys;
public class SimpleTransform {
public static void main (String args []) throws Exception {
File in = new File(args[0]);
DocumentBuilderFactory dbf;
DocumentBuilder db;
Document doc;
dbf = DocumentBuilderFactory.newInstance();
db = dbf.newDocumentBuilder ();
doc = db.parse(in);
DOMSource source = new DOMSource(doc);
TransformerFactory tff = TransformerFactory.newInstance();
Transformer tf = tff.newTransformer();
//Output as html
tf.setOutputProperty(OutputKeys.METHOD, "html");
StreamResult sr = new StreamResult(System.out);
tf.transform(source, sr);
//Output as xml
tf.setOutputProperty(OutputKeys.METHOD, "xml");
sr = new StreamResult(System.out);
tf.transform(source, sr);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]