When you construct an XMLSerializer, pass in 
an "org.apache.xml.serialize.OutputFormat" object, then call 
setOmitXMLDeclaration(true) on it.

Zhaohua Meng

Hotlens.com Inc.
http://www.hotlens.com

350 Fifth AVE
Suite 3113
New York, NY 10118
Phone: 212-465-1700
Fax: � 212-465-1710
email: [EMAIL PROTECTED]


-----Original Message-----
From: Nathan Coast <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Thu, 10 May 2001 09:17:17 +0100
Subject: Re: newbie transform question

> resolution:
> 
> transformer.setOutputProperty(OutputKeys.METHOD,"text");
> 
> 
> Nathan Coast wrote:
> 
> > Hi,
> > 
> > I'm trying to do some basic transforms using xerces / xalan using
> code 
> > like below.  The problem is that whatever transform I do, I always
> get:
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > 
> > at the start of the output.  The output isn't xml so I don't want
> this 
> > produced. Any ideas how to prevent the <?xml.... from being
> generated?
> > 
> > Thanks
> > Nathan
> > 
> > 
> > code:
> > 
> > Document doc= new DocumentImpl();
> > Element root = doc.createElement("myDocument");     // Create Root
> Element
> > root.setAttribute(.....
> > root.setAttribute(.....
> > 
> > TransformerFactory tFactory = TransformerFactory.newInstance();
> > Transformer transformer = tFactory.newTransformer(new 
> > StreamSource(myXSLFile));
> > transformer.transform(new DOMSource(root),
> StreamResult(System.out));
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to