xmlgraphics-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ayadi ines <ayadii...@yahoo.fr>
Subject CAN YOU HELP ME
Date Mon, 14 May 2007 09:10:33 GMT
i want 2 generate a pdf .So i find the ExampleXML2PDF in fop-0.93\examples\embedding\java\embedding
,but when i run  the class it makes this exception 

javax.xml.transform.TransformerException: org.apache.fop.apps.FOPException: Error(Unknown
location): No element mapping definition found for (Namespace URI: "http://xml.apache.org/fop/extensions",
Local Name: "destination")
    at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:725)
    at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:425)
    at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:216)
    at org.apache.xalan.templates.ElemApplyTemplates.transformSelectedNodes(ElemApplyTemplates.java:425)
    at org.apache.xalan.templates.ElemApplyTemplates.execute(ElemApplyTemplates.java:216)
    at  org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
    at org.apache.xalan.templates.ElemIf.execute(ElemIf.java:210)
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
    at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:185)
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
    at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:185)
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
    at org.apache.xalan.templates.ElemChoose.execute(ElemChoose.java:185)
    at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2339)
    at  org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java:2160)
    at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java:1213)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:668)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1129)
    at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1107)
    at antidote.apps.ExempleXML2PDF.main(ExempleXML2PDF.java:80)
Caused by: org.apache.fop.apps.FOPException: Error(Unknown location): No element mapping definition
found for (Namespace URI: "http://xml.apache.org/fop/extensions", Local Name: "destination")
    at org.apache.xalan.transformer.ResultTreeHandler.flushElem(ResultTreeHandler.java:870)
    at  org.apache.xalan.transformer.ResultTreeHandler.flushPending(ResultTreeHandler.java:954)
    at org.apache.xalan.transformer.ResultTreeHandler.endElement(ResultTreeHandler.java:308)
    at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:716)
    ... 19 more


i have localised the exception ,and it is generated by
 transformer.transform(src, res);
 
can you help me,this the code ,if you want others details

public class ExempleXML2PDF {

      public static void main(String[] args) {
        try {
            System.out.println("FOP ExampleXML2PDF\n");
            System.out.println("Preparing...");

            // Setup  directories
            File baseDir = new File(".");
            File outDir = new File(baseDir, "out");
            outDir.mkdirs();

            // Setup input and output files            
            File xmlfile = new File(baseDir, "xml/xml/projectteam.xml");
            File xsltfile = new File(baseDir, "xml/xslt/projectteam2fo.xsl");
            File pdffile = new File(outDir, "ResultXML2PDF.pdf");

            System.out.println("Input: XML (" +  xmlfile + ")");
            System.out.println("Stylesheet: " + xsltfile);
            System.out.println("Output: PDF (" + pdffile + ")");
            System.out.println();
            System.out.println("Transforming...");
            
            // configure fopFactory as desired
            FopFactory fopFactory = FopFactory.newInstance();

            FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
            // configure foUserAgent as  desired

            // Setup output
            OutputStream out = new java.io.FileOutputStream(pdffile);
            out = new java.io.BufferedOutputStream(out);
            
            try {
                // Construct fop with desired output format
                Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
    
                // Setup  XSLT
                TransformerFactory factory = TransformerFactory.newInstance();
                Transformer transformer = factory.newTransformer(new StreamSource(xsltfile));
                
                // Set the value of a <param> in the stylesheet
                transformer.setParameter("versionParam", "2.0");
            
                // Setup input for XSLT  transformation
                Source src = new StreamSource(xmlfile);
            
                // Resulting SAX events (the generated FO) must be piped through to FOP
                Result res = new SAXResult(fop.getDefaultHandler());
    
                // Start XSLT transformation and FOP processing
                transformer.transform(src, res);
            } finally  {
                out.close();
            }
            
            System.out.println("Success!");
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }
}

  
thanks for help

Jeremias Maerki <dev@jeremias-maerki.ch> a écrit : 
On 08.05.2007 05:24:52 The Web Maestro wrote:
> This looks good to me, Jeremias.

Thanks for reviewing.

> Web Maestro Clay
> 
> Do we want to mention something about PDFBox, or is it too soon to get
> our hopes up? 

IMO, it's too soon. Interest is one thing. People volunteering to do all
the work is another. And PDFBox can only graduate if you have a
community of at least 3 people independent from each other active on the
project. And 3 is the absolute minimum. There's a long way ahead.

> Then again, I don't know exactly which category it would
> fall: XML Graphics Commons (except it's not XML)? FOP (I'm not a
> purist, so I think this is the best place for it!)?

IMO, neither. I'd line up PDFBox as a separate TLP. XML Graphics would
only act as a sponsoring PMC.

> Cheers! :-)
> 
> On 5/7/07, Jeremias Maerki  wrote:
> > You know the drill. Additions/corrections until Friday, please.
> >
> > http://wiki.apache.org/xmlgraphics/StatusReports/StatusReportForMay2007
> >
> > Jeremias Maerki
> >
> >
> > ---------------------------------------------------------------------
> > Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
> > To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: general-help@xmlgraphics.apache.org
> >
> >
> 
> 
> -- 
> Regards,
> 
> The Web Maestro
> -- 
>  - 
> My religion is simple. My religion is kindness.
> - HH The 14th Dalai Lama of Tibet
> 
> ---------------------------------------------------------------------
> Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
> To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: general-help@xmlgraphics.apache.org



Jeremias Maerki


---------------------------------------------------------------------
Apache XML Graphics Project URL: http://xmlgraphics.apache.org/
To unsubscribe, e-mail: general-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: general-help@xmlgraphics.apache.org



             
---------------------------------
 Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message