Examples/src/main/java/org/openestate/io/examples/OpenImmoWritingExample.java
@SuppressWarnings("Duplicates")
    public static void main(String[] args) {
        // init logging
        PropertyConfigurator.configure(
                OpenImmoWritingExample.class.getResource(PACKAGE + "/log4j.properties"));

        // create an Openimmo object with some example data
        // this object corresponds to the <openimmo> root element in XML
        Openimmo openimmo = FACTORY.createOpenimmo();
        openimmo.setUebertragung(createUebertragung());
        openimmo.getAnbieter().add(createAnbieter());

        // convert the Openimmo object into a XML document
        OpenImmoTransferDocument doc = null;
        try {
            doc = OpenImmoTransferDocument.newDocument(openimmo);
        } catch (Exception ex) {
            LOGGER.error("Can't create XML document!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }

        // write XML document into a java.io.File
        try {
            write(doc, File.createTempFile("output-", ".xml"));
        } catch (IOException ex) {
            LOGGER.error("Can't create temporary file!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }

        // write XML document into a java.io.OutputStream
        write(doc, new NullOutputStream());

        // write XML document into a java.io.Writer
        write(doc, new NullWriter());

        // write XML document into a string and send it to the console
        writeToConsole(doc);

        // downgrade XML document to an earlier version
        // and write it to the console
        doc.downgrade(OpenImmoVersion.V1_2_3);
        writeToConsole(doc);

        // downgrade XML document to the first version
        // and write it to the console
        doc.downgrade(OpenImmoVersion.V1_1);
        writeToConsole(doc);
    }
@SuppressWarnings("Duplicates")
    public static void main(String[] args) {
        // init logging
        PropertyConfigurator.configure(
                OpenImmoWritingExample.class.getResource(PACKAGE + "/log4j.properties"));

        // create an Openimmo object with some example data
        // this object corresponds to the <openimmo> root element in XML
        Openimmo openimmo = FACTORY.createOpenimmo();
        openimmo.setUebertragung(createUebertragung());
        openimmo.getAnbieter().add(createAnbieter());

        // convert the Openimmo object into a XML document
        OpenImmoTransferDocument doc = null;
        try {
            doc = OpenImmoTransferDocument.newDocument(openimmo);
        } catch (Exception ex) {
            LOGGER.error("Can't create XML document!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }

        // write XML document into a java.io.File
        try {
            write(doc, File.createTempFile("output-", ".xml"));
        } catch (IOException ex) {
            LOGGER.error("Can't create temporary file!");
            LOGGER.error("> " + ex.getLocalizedMessage(), ex);
            System.exit(1);
        }

        // write XML document into a java.io.OutputStream
        write(doc, new NullOutputStream());

        // write XML document into a java.io.Writer
        write(doc, new NullWriter());

        // write XML document into a string and send it to the console
        writeToConsole(doc);

        // downgrade XML document to an earlier version
        // and write it to the console
        doc.downgrade(OpenImmoVersion.V1_2_3);
        writeToConsole(doc);

        // downgrade XML document to the first version
        // and write it to the console
        doc.downgrade(OpenImmoVersion.V1_1);
        writeToConsole(doc);
    }
@ SuppressWarnings ( "Duplicates" ) public static void main ( String [ ] args ) { // init logging PropertyConfigurator . configure ( OpenImmoWritingExample . class . getResource ( PACKAGE + "/log4j.properties" ) ) ; // create an Openimmo object with some example data // this object corresponds to the <openimmo> root element in XML Openimmo openimmo = FACTORY . createOpenimmo ( ) ; openimmo . setUebertragung ( createUebertragung ( ) ) ; openimmo . getAnbieter ( ) . add ( createAnbieter ( ) ) ; // convert the Openimmo object into a XML document OpenImmoTransferDocument doc = null ; try { doc = OpenImmoTransferDocument . newDocument ( openimmo ) ; } catch ( Exception ex ) { LOGGER . error ( "Can't create XML document!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; System . exit ( 1 ) ; } // write XML document into a java.io.File try { write ( doc , File . createTempFile ( "output-" , ".xml" ) ) ; } catch ( IOException ex ) { LOGGER . error ( "Can't create temporary file!" ) ; LOGGER . error ( "> " + ex . getLocalizedMessage ( ) , ex ) ; System . exit ( 1 ) ; } // write XML document into a java.io.OutputStream write ( doc , new NullOutputStream ( ) ) ; // write XML document into a java.io.Writer write ( doc , new NullWriter ( ) ) ; // write XML document into a string and send it to the console writeToConsole ( doc ) ; // downgrade XML document to an earlier version // and write it to the console doc . downgrade ( OpenImmoVersion . V1_2_3 ) ; writeToConsole ( doc ) ; // downgrade XML document to the first version // and write it to the console doc . downgrade ( OpenImmoVersion . V1_1 ) ; writeToConsole ( doc ) ; }
Start the example application.

@param args command line arguments
Start the example application .