What encoding is used by javax.xml.transform.Transformer?
        Posted  
        
            by 
                Simon Reeves
            
        on Programmers
        
        See other posts from Programmers
        
            or by Simon Reeves
        
        
        
        Published on 2013-05-31T11:32:35Z
        Indexed on 
            2013/06/30
            22:27 UTC
        
        
        Read the original article
        Hit count: 471
        
Please can you answer a couple of questions based on the code below (excludes the try/catch blocks), which transforms input XML and XSL files into an output XSL-FO file:
File xslFile = new File("inXslFile.xsl");
File xmlFile = new File("sourceXmlFile.xml");
TransformerFactory tFactory = TransformerFactory.newInstance();
Transformer transformer = tFactory.newTransformer(new StreamSource(xslFile));
FileOutputStream fos = new FileOutputStream(new File("outFoFile.fo");
transformer.transform(new StreamSource(xmlFile), new StreamResult(fos));
inXslFile is encoded using UTF-8 - however there are no tags in file which states this. sourceXmlFile is UTF-8 encoded and there may be a metatag at start of file indicating this.
am currently using Java 6 with intention of upgrading in the future.
- What encoding is used when reading the xslFile?
- What encoding is used when reading the xmlFile?
- What encoding will be applied to the FO outfile?
- How can I obtain the info (properties) for 1 - 3? Is there a method call?
- How can the properties in 4 be altered - using configuration and dynamically?
- if known - Where is there info (web site) on this that I can read - I have looked without much success.
© Programmers or respective owner