Package org.smooks.model.core

Examples of org.smooks.model.core.SmooksModel


    public static void main(String[] args) throws IOException, SAXException {

        ModelBuilder modelBuilder = new ModelBuilder("META-INF/org/smooks/model/descriptor.properties", false);
        Model<SmooksModel> model;
        SmooksModel smooksModel;

        // Read an instance of the model...
        model = modelBuilder.readModel(new FileReader("smooks-config.xml"), SmooksModel.class);
        smooksModel = model.getModelRoot();

        // Make modifications to the smooksModel instance etc....
        List<Bean> beans = smooksModel.getBeans();
        for(Bean bean : beans) {
            BeanMetadata beanMetadata = model.getBeanMetadata(bean);
            // etc ...
        }
View Full Code Here


        XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream(messageFile)), new StringReader(modelWriter.toString()));
    }

    public void test_programmatic_build() throws IOException, SAXException {
        SmooksModel smooksModel = new SmooksModel();
        Model<SmooksModel> model = new Model<SmooksModel>(smooksModel, modelBuilder);
        CSVReader csvReader = new CSVReader();

        // Populate it...
        csvReader.setFields("name,address,age");
        csvReader.setRootElementName("people");
        csvReader.setRecordElementName("person");
        csvReader.setIndent(true);

        // Need to register all the "namespace root" bean instances...
        model.registerBean(csvReader);

        // Add it in the appropriate place in the object graph....
        smooksModel.getReaders().add(csvReader);

        ListBinding listBinding = new ListBinding();
        listBinding.setBeanId("beanX");
        listBinding.setBeanClass("com.acme.XClass");
View Full Code Here

        XMLUnit.setIgnoreWhitespace( true );
        XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream(messageFile)), new StringReader(modelWriter.toString()));
    }

    public void test_programmatic_build() throws IOException, SAXException {
        SmooksModel smooksModel = new SmooksModel();
        Model<SmooksModel> model = new Model<SmooksModel>(smooksModel, modelBuilder);
        CSVReader csvReader = new CSVReader();

        // Populate it...
        csvReader.setFields("name,address,age");
        csvReader.setRootElementName("people");
        csvReader.setRecordElementName("person");
        csvReader.setIndent(true);

        // Set strict on the model... should have no effect as it's not supported in v1.2...
        csvReader.setStrict(true);

        // Need to register all the "namespace root" bean instances...
        model.registerBean(csvReader).setNamespace("http://www.milyn.org/xsd/smooks/csv-1.2.xsd").setNamespacePrefix("csv12");

        // Add it in the appropriate place in the object graph....
        smooksModel.getReaders().add(csvReader);

        ListBinding listBinding = new ListBinding();
        listBinding.setBeanId("beanX");
        listBinding.setBeanClass("com.acme.XClass");
View Full Code Here

TOP

Related Classes of org.smooks.model.core.SmooksModel

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.