Package pt.opensoft.xml

Examples of pt.opensoft.xml.XmlBuilder


        return getEmailTemplate(id, templateFilePrefix, null);
    }

    public Template getEmailTemplate(String id, String templateFilePrefix, File templateFooter) throws IOException, JDOMException {

        XmlBuilder xmlBuilder = new XmlBuilder(false)// TODO: Validar contra um schema
        xmlBuilder.parse(new InputStreamReader(ResourceLoader.getResourceStream(templateFilePrefix + id + ".xml"), "ISO-8859-1"));

        Template template = new Template(xmlBuilder.getDocument().getRootElement());
        if (!template.hasFooter() && templateFooter != null) template.setFooter(FileUtil.readFile(templateFooter));

        return template;
    }
View Full Code Here


        return template;
    }

    public MessageTemplate getMessageTemplate(String id, String templateFilePrefix) throws IOException, JDOMException {

        XmlBuilder xmlBuilder = new XmlBuilder(false)// TODO: Validar contra um schema
        xmlBuilder.parse(new InputStreamReader(ResourceLoader.getResourceStream(templateFilePrefix + id + ".xml"), "ISO-8859-1"));

        MessageTemplate template = new MessageTemplate(xmlBuilder.getDocument().getRootElement());

        return template;
    }
View Full Code Here

     * @author <a href="mailto:tpais@opensoft.pt">Tiago Pais @ Opensoft </a>
     * @see pt.opensoft.mail.Template
     */
    public Template getEmailTemplate(String id, String templateFilePrefix, File templateFooter, String codePage) throws IOException, JDOMException {

        XmlBuilder xmlBuilder = new XmlBuilder(false)// TODO: Validar contra um schema
        xmlBuilder.parse(new InputStreamReader(ResourceLoader.getResourceStream(templateFilePrefix + id + ".xml"), codePage));

        Template template = new Template(xmlBuilder.getDocument().getRootElement());
        if (!template.hasFooter() && templateFooter != null) template.setFooter(FileUtil.readFile(templateFooter));

        return template;
    }
View Full Code Here

     * @author <a href="mailto:tpais@opensoft.pt">Tiago Pais @ Opensoft </a>
     * @see pt.opensoft.mail.MessageTemplate
     */
    public MessageTemplate getMessageTemplate(String id, String templateFilePrefix, String codePage) throws IOException, JDOMException {

        XmlBuilder xmlBuilder = new XmlBuilder(false)// TODO: Validar contra um schema
        xmlBuilder.parse(new InputStreamReader(ResourceLoader.getResourceStream(templateFilePrefix + id + ".xml"), codePage));

        MessageTemplate template = new MessageTemplate(xmlBuilder.getDocument().getRootElement());

        return template;
    }
View Full Code Here

*/
public class PDFFillerTester {

    public static void execute(String xmlFile, String originalPdf, String finalPdf) throws IOException, JDOMException, DocumentException {

        XmlBuilder builder = new XmlBuilder(true);
        builder.setSchema("PDF_Placer.xsd", false);
        List errors = builder.parse(new FileReader(xmlFile));
        if (errors != null && !errors.isEmpty()) {
            System.out.println("O ficheiro " + xmlFile + " cont�m erros:");
            for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
                SAXParseException parseException = (SAXParseException) iterator.next();
                System.out.println("[" + parseException.getLineNumber() + "]: " + parseException.getLocalizedMessage());
            }
        } else {
            PDFFiller filler = new PDFFiller(builder.getDocument());
            filler.fill(originalPdf, new FileOutputStream(finalPdf), new HashMap());   // mapa de valores vai vazio em testes
        }
    }
View Full Code Here

TOP

Related Classes of pt.opensoft.xml.XmlBuilder

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.