Collin VanDyck
Usenet Archive
- Joined
- May 5, 2003
- Messages
- 134
- Reaction score
- 0
I'm a semi-newbie to XSL transformations, so hopefully you guys can tell me what I'm doing wrong here. I have a string that is an XML document that I am running through a Xalan transformer:
public String transform (String pageXML) throws SAXException , IOException { XMLReader reader = XMLReaderFactory.createXMLReader;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream; Properties p = OutputProperties.getDefaultMethodProperties("xml"); Serializer serializer = SerializerFactory.getSerializer(p); serializer.setOutputStream(outputStream);
this.setParent(reader);
this.setContentHandler(serializer.asContentHandler);
InputSource input = new InputSource(new StringReader(new String(pageXML))); this.parse(input);
String toReturn = outputStream.toString;
return toReturn;
Note: 'this' is a subclass of XMLFilterImpl. In the source XML, I have a
SSI like this:
<!--#include /path/file.asp-->
This is getting erased somehow in the transformation. I suspect that it has something to do with the Properties object I am using to create my Serializer. Is there some property I need to set to allow comments? Also, I could not find a reference in my Googling for a list of the possible output properties. I think I'm missing something pretty simple here.
I tested this with an empty class of XMLFilterImpl, with the same results, so I know it is not my SAX event overrides causing this problem.
Thanks in advance!
public String transform (String pageXML) throws SAXException , IOException { XMLReader reader = XMLReaderFactory.createXMLReader;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream; Properties p = OutputProperties.getDefaultMethodProperties("xml"); Serializer serializer = SerializerFactory.getSerializer(p); serializer.setOutputStream(outputStream);
this.setParent(reader);
this.setContentHandler(serializer.asContentHandler);
InputSource input = new InputSource(new StringReader(new String(pageXML))); this.parse(input);
String toReturn = outputStream.toString;
return toReturn;
Note: 'this' is a subclass of XMLFilterImpl. In the source XML, I have a
SSI like this:
<!--#include /path/file.asp-->
This is getting erased somehow in the transformation. I suspect that it has something to do with the Properties object I am using to create my Serializer. Is there some property I need to set to allow comments? Also, I could not find a reference in my Googling for a list of the possible output properties. I think I'm missing something pretty simple here.
I tested this with an empty class of XMLFilterImpl, with the same results, so I know it is not my SAX event overrides causing this problem.
Thanks in advance!