You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Daniel Pfuhl <da...@web.de> on 2001/05/10 11:28:18 UTC

XML Output Format

Hi

For a while I'm trying to read an xml-file
into dom - transforming it using xalan and
modifying it also. after that i want to 
write the "new" dom to a file. All works
fine but of formatting the output. There
are no linebreaks after each tag and some-
times tags are "broken". What am I done 
wrong??

****************************************

try {
	FileWriter out = new FileWriter("c:/test.xml");
	
      	OutputFormat formatt = new OutputFormat(doc); 
        	formatt.setIndenting(true); 
        	formatt.setIndent(6);      
        	XMLSerializer serializer = new XMLSerializer(out, formatt);

	try {
		serializer.serialize(doc.getDocumentElement());
		}
		catch (IOException ex) {
            				ex.printStackTrace();
        				}
	out.toString();
	out.close();

****************************************

and this a part of my output:

################################################################
<?xml version="1.0" encoding="UTF-8"?>
<metadatascheme>       <general>                  <identifier
      action="input" type="string"/>       <title action="input"
    type="string"/>       <catalogentry>
        <catalogue action="input" type="string"/>          <entry
        action="input" type="string"/>
    </catalogentry>       <language>   <choice type="string">
        <value>English</value>
        <value>German</value>
        <value>French</value>
      </choice>  </language>       <description action="input"
    type="string"/>       
################################################################

It would be very nice if someone can point me in the right
direction...

thanks in advance

daniel
------------------------------------------
Daniel Pfuhl
mailto:daniel@dphome.de
_______________________________________________________________________
1.000.000 DM gewinnen - kostenlos tippen - http://millionenklick.web.de
IhrName@web.de, 8MB Speicher, Verschluesselung - http://freemail.web.de