You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Stadelmann Adi <Ad...@bison-group.com> on 2001/12/19 17:46:33 UTC

serializing with jaxp with mixed sources (dom elements and sax) to one result

hi,
i'm trying to serialize through jaxp like

target=new StreamTarget(new FileWriter("output.xml"));
TransformerFactory.newInstance().newTransformer().transform( source, target);

but the source is splitted in many little Dom-Trees 
	//first start document
	startElement("Root");
	//then many Nodes as DOM-Trees;
	transform( new DOMSource(firstNode), target);
	transform( new DOMSource(secondNode), target);
	transform( new DOMSource(fxyNode), target);
	transform( new DOMSource(lastNode), target);
	//end of document
	endElement("Root");

how can i do that through jaxp?
or do i need xerces serializer like

    	SerializerFactory factory=SerializerFactory.getSerializerFactory(_method);
    	OutputFormat outputFormat=new OutputFormat(_method,_encoding,true);
    	outputFormat.setIndent(2);  
    	outputFormat.setLineWidth(0);
    	outputFormat.setPreserveSpace(true);
    	outputFormat.setOmitXMLDeclaration( _omitXMLDeclaration );
    	serializer=factory.makeSerializer(outputStream,outputFormat);
	ContentHandler docSerializer=getSerializer().asContentHandler();
	docSerializer.startDocument();
	docSerializer.startElement(null,null,"Root",null);

Adrian Stadelmann
Software Development

---------------------------------------------------
BISON Schweiz AG
Eichweid 5
CH-6203 Sempach-Station

Phone direct	+41 41 469 65 03
E-Mail	mailto:adrian.stadelmann@bison-group.com
Homepage	www.bison-group.com



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org