Package org.dom4j.jaxb

Examples of org.dom4j.jaxb.JAXBReader


    public void demoRead() {
        try {
            File inputFile = new File("xml/jaxb/primer.xml");

            JAXBReader jaxbReader = new JAXBReader("org.dom4j.test.primer");

            System.out
                    .println("Fetched PurchaseOrders using JAXBObjectHandler:");
            jaxbReader.addObjectHandler("/purchaseOrders/purchaseOrder",
                    new PurchaseOrderHandler());
            Document doc = jaxbReader.read(inputFile);

            System.out.println("Fetched PurchaseOrders using DOM4J document:");
            Iterator orderIt = doc.selectNodes("/purchaseOrders/purchaseOrder")
                    .iterator();
            while (orderIt.hasNext()) {
View Full Code Here


    public void demoReadPrune() {
        try {
            File inputFile = new File("xml/jaxb/primer.xml");

            JAXBReader jaxbReader = new JAXBReader("org.dom4j.test.primer");

            System.out
                    .println("Fetched PurchaseOrders using JAXBObjectHandler:");
            jaxbReader.setPruneElements(true);
            jaxbReader.addObjectHandler("/purchaseOrders/purchaseOrder",
                    new PurchaseOrderHandler());
            Document doc = jaxbReader.read(inputFile);

            System.out.println("Pruned document:");
            System.out.println(doc.asXML());
            System.out.println();
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.dom4j.jaxb.JAXBReader

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.