Pretty-printing output from javax.xml.transform.Transformer with only standard java api (Indentation and Doctype positioning)

前端 未结 4 1385
长发绾君心
长发绾君心 2020-11-27 02:39

Using the following simple code:

package test;

import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;

public class TestOutput         


        
4条回答
  •  清酒与你
    2020-11-27 03:25

    To make the output a valid XML document, NO. A valid XML document must start with a processing instruction. See the XML specification http://www.w3.org/TR/REC-xml/#sec-prolog-dtd for more details.

提交回复
热议问题