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

        // create a Daft object with some example data
        // this object corresponds to the <daft> root element in XML
        Daft daft = FACTORY.createDaft();

        // append some example objects for rent to the Daft object
        daft.setOverseasRental(FACTORY.createDaftOverseasRental());
        daft.getOverseasRental().getOverseasRentalAd().add(createAdForRent());
        daft.getOverseasRental().getOverseasRentalAd().add(createAdForRent());

        // append some example objects for sale to the Daft object
        daft.setOverseasSales(FACTORY.createDaftOverseasSales());
        daft.getOverseasSales().getOverseasSaleAd().add(createAdForSale());
        daft.getOverseasSales().getOverseasSaleAd().add(createAdForSale());
        daft.getOverseasSales().getOverseasSaleAd().add(createAdForSale());

        // convert the Daft object into a XML document
        DaftIeDocument doc = null;
        try {
            doc = DaftIeDocument.newDocument(daft);
        } 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);
    }
@SuppressWarnings("Duplicates")
    public static void main(String[] args) {
        // init logging
        PropertyConfigurator.configure(
                DaftIeWritingExample.class.getResource(PACKAGE + "/log4j.properties"));

        // create a Daft object with some example data
        // this object corresponds to the <daft> root element in XML
        Daft daft = FACTORY.createDaft();

        // append some example objects for rent to the Daft object
        daft.setOverseasRental(FACTORY.createDaftOverseasRental());
        daft.getOverseasRental().getOverseasRentalAd().add(createAdForRent());
        daft.getOverseasRental().getOverseasRentalAd().add(createAdForRent());

        // append some example objects for sale to the Daft object
        daft.setOverseasSales(FACTORY.createDaftOverseasSales());
        daft.getOverseasSales().getOverseasSaleAd().add(createAdForSale());
        daft.getOverseasSales().getOverseasSaleAd().add(createAdForSale());
        daft.getOverseasSales().getOverseasSaleAd().add(createAdForSale());

        // convert the Daft object into a XML document
        DaftIeDocument doc = null;
        try {
            doc = DaftIeDocument.newDocument(daft);
        } 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);
    }
@ SuppressWarnings ( "Duplicates" ) public static void main ( String [ ] args ) { // init logging PropertyConfigurator . configure ( DaftIeWritingExample . class . getResource ( PACKAGE + "/log4j.properties" ) ) ; // create a Daft object with some example data // this object corresponds to the <daft> root element in XML Daft daft = FACTORY . createDaft ( ) ; // append some example objects for rent to the Daft object daft . setOverseasRental ( FACTORY . createDaftOverseasRental ( ) ) ; daft . getOverseasRental ( ) . getOverseasRentalAd ( ) . add ( createAdForRent ( ) ) ; daft . getOverseasRental ( ) . getOverseasRentalAd ( ) . add ( createAdForRent ( ) ) ; // append some example objects for sale to the Daft object daft . setOverseasSales ( FACTORY . createDaftOverseasSales ( ) ) ; daft . getOverseasSales ( ) . getOverseasSaleAd ( ) . add ( createAdForSale ( ) ) ; daft . getOverseasSales ( ) . getOverseasSaleAd ( ) . add ( createAdForSale ( ) ) ; daft . getOverseasSales ( ) . getOverseasSaleAd ( ) . add ( createAdForSale ( ) ) ; // convert the Daft object into a XML document DaftIeDocument doc = null ; try { doc = DaftIeDocument . newDocument ( daft ) ; } 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 ) ; }
Start the example application.

@param args command line arguments
Start the example application .