Package com.wutka.jox

Examples of com.wutka.jox.MyJOXBeanOutputStream


        String dtd =  extractDtd(outputXmlFileName);
        return toXML(bean, dtd, outputXmlFileName);
    }
   
    public static boolean toXML(Object bean, String dtdFileName, String outputXmlFileName) throws Exception {
        MyJOXBeanOutputStream joxOut = null;
        DTD dtd = null;
        FileOutputStream fileOut = new FileOutputStream(outputXmlFileName);
       
        if (dtdFileName != null) {
            FileReader reader = new FileReader(dtdFileName);
            DTDParser dtdParser = new DTDParser(reader);
           
            dtd = dtdParser.parse();
            reader.close();
            joxOut = new MyJOXBeanOutputStream(dtd, fileOut);
        } else {
            //JOXBeanOutputStream joxOut = new JOXBeanOutputStream(dtd, fileOut);
            //ByteArrayOutputStream xmlData = new ByteArrayOutputStream();
            joxOut = new MyJOXBeanOutputStream(fileOut);
        }
       
        try {
            joxOut.writeObject(beanName(bean), bean, doctypeDeclaration);
            //IndentingParser.writeIdented(outputXmlFileName);
        } catch (IOException exc) {
            exc.printStackTrace();
            return false; //null;
        } finally {
            try {
                //xmlData.close();
                fileOut.close();
                joxOut.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
       
View Full Code Here

TOP

Related Classes of com.wutka.jox.MyJOXBeanOutputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.