IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

XML/XSL et SOAP Discussion :

Problème avec FOP apache


Sujet :

XML/XSL et SOAP

  1. #1
    Futur Membre du Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2014
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 33
    Localisation : Autre

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 13
    Points : 8
    Points
    8
    Par défaut Problème avec FOP apache
    Bonjour,
    je viens de créer mon .Xsl et mon .XML . je les ai mis dans fop avec la commande suivante : fop -XML fichier.xml -xsl fichier Xsl-PDF fichier.pdf .Le fichier PDF c'est créer rapidement puis il n’apparaît plus voila l'erreur qu'il m'affiche :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
     
    [Fatal Error] rapport.xsl:9:53: The character reference must end with the ';' de
    limiter.
    file:/C:/Users/iza/.fop/fop-1.1-bin/fop-1.1/rapport.xsl; Ligne #9; Colon
    ne #53; org.xml.sax.SAXParseException; systemId: file:/C:/Users/iza/.fop
    /fop-1.1-bin/fop-1.1/rapport.xsl; lineNumber: 9; columnNumber: 53; The character
     reference must end with the ';' delimiter.
    mai 21, 2014 9:35:42 AM org.apache.fop.cli.Main startFOP
    Grave: Exception
    org.apache.fop.apps.FOPException
    java.lang.NullPointerException
            at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:303)
            at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
            at org.apache.fop.cli.Main.startFOP(Main.java:177)
            at org.apache.fop.cli.Main.main(Main.java:208)
    Caused by: java.lang.NullPointerException
            at org.apache.xalan.transformer.TransformerImpl.setParameter(Transformer
    Impl.java:1558)
            at org.apache.xalan.transformer.TransformerImpl.setParameter(Transformer
    Impl.java:1606)
            at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:286)
            ... 3 more
     
    ---------
     
    java.lang.NullPointerException
            at org.apache.xalan.transformer.TransformerImpl.setParameter(Transformer
    Impl.java:1558)
            at org.apache.xalan.transformer.TransformerImpl.setParameter(Transformer
    Impl.java:1606)
            at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:286)
            at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
            at org.apache.fop.cli.Main.startFOP(Main.java:177)
            at org.apache.fop.cli.Main.main(Main.java:208)
    Merci

  2. #2
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 551
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 551
    Points : 21 607
    Points
    21 607
    Par défaut
    Le message d'erreur dit qu'il y a un problème (barbarement décrit "The character reference must end with the ';' delimiter.",) dans le fichier rapport.xsl, ligne 9, colonne 53.
    As-tu essayé de regarder ce qui s'y trouve, et de te demander ce qui peut lui déplaire aux alentours ?

    Si oui, et que tu ne vois rien d'étrange, peut-être que nous nous pourrions voir quelque chose. Pourquoi as-tu choisi de ne pas montrer de code du tout ?
    Même si "le fichier est trop grand," ça signifie simplement que tu dois d'abord raccourcir le fichier, de sorte qu'il ait le même problème mais soit beaucoup plus petit, puis nous montrer ça.
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  3. #3
    Futur Membre du Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2014
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 33
    Localisation : Autre

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 13
    Points : 8
    Points
    8
    Par défaut
    Merci thelvin
    oui effectivement j'ai regardé et je n'ai rien vu d’étrange
    je débute ce que je veux faire c'est qu'il me sorte mon PDF pour voir le résultat. Après j'ai beaucoup d'amélioration à faire sur le fichier Xsl comme mettre une condition à la balise table pour qu'il génère un tableau dès qu'il trouve table non pas table1 et table2 etc..
    voici mon fichier Xsl

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
     
    <?xml version="1.0" encoding="ISO-8859-1"?>
     
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     
    <xsl:template match="/">
      <html>
      <body>
    <h4><xsl:value-of select="rapport/societe"/></h4>
    <xsl:value-of select="rapport/nonUtilisateur"/>
    <xsl:value-of select="rapport/date"/>
    <xsl:value-of select="rapport/horloge"/>
    <h5 align="center"><u><xsl:value-of select="/rapport/titre"/></u></h5>
     
    <h6>Table code :<xsl:value-of select="rapport/CODE_TABLE"/>
     <xsl:value-of select="rapport/LIB_TABLE"/></h6>
    <h6>Format des codes instances :<xsl:value-of select="rapport/FORMAT_TABLE"/></h6>
     
        <table border="0" bgcolor="">
          <tr bgcolor="#CECECE">
            <th style="text-align:left">code langage</th>
            <th style="text-align:left">code instance</th>
            <th style="text-align:left">libelle court</th>
            <th style="text-align:left">libelle long</th>
            <th style="text-align:left">Code table ref resul</th>
          </tr>
          <xsl:for-each select="rapport/table1/Ligne">
          <tr>
            <td><xsl:value-of select="Col1"/></td>
            <td><xsl:value-of select="Col2"/></td>
            <td><xsl:value-of select="Col3"/></td>
            <td><xsl:value-of select="Col4"/></td>
            <td><xsl:value-of select="Col5"/></td>
          </tr>
          </xsl:for-each>
        </table>
     
    <h6>Table code :<xsl:value-of select="rapport/CODE_TABLE"/>
     <xsl:value-of select="rapport/LIB_TABLE"/></h6>
    <h6>Format des codes instances :<xsl:value-of select="rapport/FORMAT_TABLE"/></h6>
     
    <table border="0" bgcolor="">
          <tr bgcolor="#CECECE">
            <th style="text-align:left">code langage</th>
            <th style="text-align:left">code instance</th>
            <th style="text-align:left">libelle court</th>
            <th style="text-align:left">libelle long</th>
            <th style="text-align:left">Code table ref resul</th>
          </tr>
          <xsl:for-each select="rapport/table2/Ligne">
          <tr>
            <td><xsl:value-of select="Col1"/></td>
            <td><xsl:value-of select="Col2"/></td>
            <td><xsl:value-of select="Col3"/></td>
            <td><xsl:value-of select="Col4"/></td>
            <td><xsl:value-of select="Col5"/></td>
          </tr>
          </xsl:for-each>
        </table>
      </body>
      </html>
    </xsl:template>
    </xsl:stylesheet>

  4. #4
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 551
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 551
    Points : 21 607
    Points
    21 607
    Par défaut
    Moi, je n'ai pas de problème avec ce fichier.

    Tu es sûr que tu utilises celui-ci ? Tu n'aurais pas, par hasard, d'autres fichiers xsl qui traînent ici ou là, et celui que tu utiliserais ne serait pas celui que tu as posté ici ?
    Si tu copies/colles le fichier indiqué, C:/Users/iza/.fop/fop-1.1-bin/fop-1.1/rapport.xsl , ça donne quoi ?

    ... Je dis ça par exemple parce que la ligne <h5 align="center"><u><xsl:value-of select="/rapport/titre"/></u></h5> est la seule qui utilise /rapport/ au lieu de rapport/ , ce qui laisse penser qu'elle a été travaillée séparément des autres. Et elle est très proche de l'emplacement supposé du message d'erreur.
    Il pourrait y avoir d'autres lignes autour d'elles, ou elle pourrait être différente, dans une autre version de ce fichier.
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  5. #5
    Futur Membre du Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2014
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 33
    Localisation : Autre

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 13
    Points : 8
    Points
    8
    Par défaut
    oui effectivement tu avais raison pour la version : oops: c'était une ancienne avec des espaces de ce genre *
    mais mnt j'ai ce problème que je trouve pas logique vu qu'il me demande le .Fo alors que ma commande était bien celle du .XML et .Xsl pour qu'il me génère un .PDF
    voilà l'erreur elle est un peu longue
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
     
    C:\Users\iza\.fop\fop-1.1-bin\fop-1.1>fop -xml rapport.xml -xsl rapport.
    xsl -pdf rapport.pdf
    mai 21, 2014 3:13:00 PM org.apache.fop.cli.Main startFOP
    Grave: Exception
    org.apache.fop.apps.FOPException: org.apache.fop.fo.ValidationException: First e
    lement must be the fo:root formatting object. Found (Namespace URI: "", Local Na
    me: "html") instead. Please make sure you're producing a valid XSL-FO document.
    javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException:
     First element must be the fo:root formatting object. Found (Namespace URI: "",
    Local Name: "html") instead. Please make sure you're producing a valid XSL-FO do
    cument.
            at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:303)
            at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
            at org.apache.fop.cli.Main.startFOP(Main.java:177)
            at org.apache.fop.cli.Main.main(Main.java:208)
    Caused by: javax.xml.transform.TransformerException: org.apache.fop.fo.Validatio
    nException: First element must be the fo:root formatting object. Found (Namespac
    e URI: "", Local Name: "html") instead. Please make sure you're producing a vali
    d XSL-FO document.
            at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResul
    t.java:1323)
            at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr
    ansformerImpl.java:2411)
            at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResul
    t.java:1374)
            at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr
    ansformerImpl.java:2411)
            at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Tran
    sformerImpl.java:2281)
            at org.apache.xalan.transformer.TransformerImpl.transformNode(Transforme
    rImpl.java:1367)
            at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:709)
            at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:1284)
            at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:1262)
            at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:300)
            ... 3 more
    Caused by: org.apache.fop.fo.ValidationException: First element must be the fo:r
    oot formatting object. Found (Namespace URI: "", Local Name: "html") instead. Pl
    ease make sure you're producing a valid XSL-FO document.
            at org.apache.fop.events.ValidationExceptionFactory.createException(Vali
    dationExceptionFactory.java:38)
            at org.apache.fop.events.EventExceptionManager.throwException(EventExcep
    tionManager.java:58)
            at org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBr
    oadcaster.java:175)
            at com.sun.proxy.$Proxy0.invalidFORoot(Unknown Source)
            at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuil
    der.java:259)
            at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)
            at org.apache.xml.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandl
    er.java:204)
            at org.apache.xml.serializer.ToSAXHandler.flushPending(ToSAXHandler.java
    :277)
            at org.apache.xml.serializer.ToXMLSAXHandler.startPrefixMapping(ToXMLSAX
    Handler.java:348)
            at org.apache.xml.serializer.ToXMLSAXHandler.startPrefixMapping(ToXMLSAX
    Handler.java:318)
            at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResul
    t.java:1315)
            ... 12 more
     
    ---------
     
    javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException:
     First element must be the fo:root formatting object. Found (Namespace URI: "",
    Local Name: "html") instead. Please make sure you're producing a valid XSL-FO do
    cument.
            at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResul
    t.java:1323)
            at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr
    ansformerImpl.java:2411)
            at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResul
    t.java:1374)
            at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr
    ansformerImpl.java:2411)
            at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Tran
    sformerImpl.java:2281)
            at org.apache.xalan.transformer.TransformerImpl.transformNode(Transforme
    rImpl.java:1367)
            at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:709)
            at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:1284)
            at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:1262)
            at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:300)
            at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
            at org.apache.fop.cli.Main.startFOP(Main.java:177)
            at org.apache.fop.cli.Main.main(Main.java:208)
    Caused by: org.apache.fop.fo.ValidationException: First element must be the fo:r
    oot formatting object. Found (Namespace URI: "", Local Name: "html") instead. Pl
    ease make sure you're producing a valid XSL-FO document.
            at org.apache.fop.events.ValidationExceptionFactory.createException(Vali
    dationExceptionFactory.java:38)
            at org.apache.fop.events.EventExceptionManager.throwException(EventExcep
    tionManager.java:58)
            at org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBr
    oadcaster.java:175)
            at com.sun.proxy.$Proxy0.invalidFORoot(Unknown Source)
            at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuil
    der.java:259)
            at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)
            at org.apache.xml.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandl
    er.java:204)
            at org.apache.xml.serializer.ToSAXHandler.flushPending(ToSAXHandler.java
    :277)
            at org.apache.xml.serializer.ToXMLSAXHandler.startPrefixMapping(ToXMLSAX
    Handler.java:348)
            at org.apache.xml.serializer.ToXMLSAXHandler.startPrefixMapping(ToXMLSAX
    Handler.java:318)
            at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResul
    t.java:1315)
            ... 12 more
    ---------
    org.apache.fop.fo.ValidationException: First element must be the fo:root formatt
    ing object. Found (Namespace URI: "", Local Name: "html") instead. Please make s
    ure you're producing a valid XSL-FO document.
            at org.apache.fop.events.ValidationExceptionFactory.createException(Vali
    dationExceptionFactory.java:38)
            at org.apache.fop.events.EventExceptionManager.throwException(EventExcep
    tionManager.java:58)
            at org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBr
    oadcaster.java:175)
            at com.sun.proxy.$Proxy0.invalidFORoot(Unknown Source)
            at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuil
    der.java:259)
            at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)
            at org.apache.xml.serializer.ToXMLSAXHandler.closeStartTag(ToXMLSAXHandl
    er.java:204)
            at org.apache.xml.serializer.ToSAXHandler.flushPending(ToSAXHandler.java
    :277)
            at org.apache.xml.serializer.ToXMLSAXHandler.startPrefixMapping(ToXMLSAX
    Handler.java:348)
            at org.apache.xml.serializer.ToXMLSAXHandler.startPrefixMapping(ToXMLSAX
    Handler.java:318)
            at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResul
    t.java:1315)
            at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr
    ansformerImpl.java:2411)
            at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResul
    t.java:1374)
            at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Tr
    ansformerImpl.java:2411)
            at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Tran
    sformerImpl.java:2281)
            at org.apache.xalan.transformer.TransformerImpl.transformNode(Transforme
    rImpl.java:1367)
            at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:709)
            at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:1284)
            at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImp
    l.java:1262)
            at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:300)
            at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
            at org.apache.fop.cli.Main.startFOP(Main.java:177)
            at org.apache.fop.cli.Main.main(Main.java:208)

  6. #6
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 551
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 551
    Points : 21 607
    Points
    21 607
    Par défaut
    Eh bien quoi ? Un PDF ce n'est pas un .fo

    Le cœur de métier de FOP est de prendre un fichier .fo et d'en faire un PDF.
    L'usage avec les .fo, c'est de les générer à partir d'un fichier .xml quelconque, sur lequel on applique une transformation XSLT, qui génère un focument XSL-FO. FOP autorise de procéder ainsi et c'est ce que tu lui as demandé.

    Voilà ce que ça donne :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
            XML       +     XSLT         =>              XSL-FO               =>         PDF
    (fichier entrée)    (fichier entrée)     (document temporaire en mémoire)     (fichier sortie)
    Or, dans ton cas, le XML + XSLT ne produit pas un document XSL-FO. Il produit un document HTML.
    FOP ne peut rien faire à partir de là. Il fallait un document XSL-FO. FOP ne convertit pas les documents HTML en PDF, ce n'est pas son travail.
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  7. #7
    Futur Membre du Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2014
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 33
    Localisation : Autre

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 13
    Points : 8
    Points
    8
    Par défaut
    Alors pourquoi il me donne la main pour mettre un fichier .XML et un .xsl pour produire un PDF s'il ne peut le faire qu'avec un .fo?
    j'ai fait appel à la 3éme commande
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    [Examples]
     fop foo.fo foo.pdf
     fop -fo foo.fo -pdf foo.pdf (does the same as the previous line)
     fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf
     fop -xml foo.xml -xsl foo.xsl -foout foo.fo
     fop -xml - -xsl foo.xsl -pdf -
     fop foo.fo -mif foo.mif
     fop foo.fo -rtf foo.rtf
     fop foo.fo -print
     fop foo.fo -awt

  8. #8
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 551
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 551
    Points : 21 607
    Points
    21 607
    Par défaut
    Comme le montre mon graphe, le .fo est une étape intermédiaire qui doit être produite à l'aide de ce xml et de ce xslt.
    Ensuite le pdf est produit à l'aide du .fo qui lui-même a été produit.

    De toute façon, pourquoi ça marcherait en mettant des balises <html> et <body> et tout ça ?
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  9. #9
    Futur Membre du Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2014
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 33
    Localisation : Autre

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 13
    Points : 8
    Points
    8
    Par défaut
    je viens de comprendre ce que tu veux dire , j'ai fait une petite recherche j'ai trouvé qu'il existe un convertisseur de XHTML au .fo voila le lien http://webcoder.info/downloads/xhtml2fo.html
    mais je n'ai pas su comment il fonctionne si tu peux m'aider

    Mercii

  10. #10
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 551
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 551
    Points : 21 607
    Points
    21 607
    Par défaut
    Ouais je le connais. Pas parfait, mais il est bien pour gagner du temps.
    C'est juste une autre feuille de style XSLT. Tu l'appliques sur un XML qui est en fait un document XHTML, et il te produit un XSL-FO qui a à peu près la même tête.

    Donc dans ton cas ça sera :

    Étape 1 : générer du XHTML. Prendre ton fichier XML, une feuille de style faite par tes soins, pour générer un fichier XHTML. Cela peut se faire avec n'importe quel moteur XSLT, pas forcément FOP.
    Étape 2 : générer le PDF. Prendre ton fichier XHTML généré, la feuille de style xhtml2fo.xsl, pour générer le fichier PDF final. Cela nécessite FOP.
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  11. #11
    Futur Membre du Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2014
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 33
    Localisation : Autre

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 13
    Points : 8
    Points
    8
    Par défaut
    Je n'ai pas compris comment procéder
    avec mon .xml et mon .xsl que je t'ai montré comment je peux générer un xhtm?
    et puis comment à partir de celui la (xhtml) j'associe le xhtml2fo pour qu'il devient un .pdf
    Désolé pour mes questions mais je suis vraiment bloqué

  12. #12
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 551
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 551
    Points : 21 607
    Points
    21 607
    Par défaut
    Avec FOP. C'est à ça qu'il sert. Il prend un XML et un XSLT et il en fait un PDF.
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  13. #13
    Futur Membre du Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2014
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 33
    Localisation : Autre

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 13
    Points : 8
    Points
    8
    Par défaut
    Je n'ai toujours pas compris mais merci quand même thelvin pour ton aide et ta patience

  14. #14
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 551
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 551
    Points : 21 607
    Points
    21 607
    Par défaut
    Quand j'ai dit qu'il y a deux étapes, c'est pas pour rigoler.
    Tu dois lancer une commande pour faire l'étape 1 et tu dois lancer une commande pour faire l'étape 2.
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  15. #15
    Futur Membre du Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2014
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 33
    Localisation : Autre

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 13
    Points : 8
    Points
    8
    Par défaut
    @thelvin
    je ne voie pas qu'elle commande je dois lancer pour les deux étapes vu que dans FOP il n'y a que c'est options
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
     [Examples]
      fop foo.fo foo.pdf
      fop -fo foo.fo -pdf foo.pdf (does the same as the previous line)
      fop -xml foo.xml -xsl foo.xsl -pdf foo.pdf
      fop -xml foo.xml -xsl foo.xsl -foout foo.fo
      fop -xml - -xsl foo.xsl -pdf -
      fop foo.fo -mif foo.mif
      fop foo.fo -rtf foo.rtf
      fop foo.fo -print
      fop foo.fo -awt
    Puis si t'as une idée sur COCOON d’apache et si il peut m’être utile en quelque chose dans ce que je veux faire (xml +xsl ->pdf)

    Merci

  16. #16
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 551
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 551
    Points : 21 607
    Points
    21 607
    Par défaut
    - Première étape : en même temps j'ai déjà dit qu'elle n'est pas spécialement pour FOP, puisqu'il n'y a pas de XSL-FO dedans. N'importe quel processeur XSLT peut s'en charger.
    Mais on peut forcer FOP à faire juste moteur XSLT, avec la commande qui génère le XSL-FO sans s'en servir :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    fop -xml foo.xml -xsl foo.xsl -foout foo.fo
    qui devient
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    fop -xml machin.xml -xsl bidule.xsl -foout chose.xhtml
    C'est du bricolage, mais en même temps, pourquoi utiliser fop au lieu de xsltproc, aussi ?

    - Deuxième étape : prendre un XML et un XSLT pour générer un PDF, mince alors, c'est pas du tout la raison pour laquelle FOP existe, ça... Ah si tiens.
    Tu n'as trouvé aucune commande dans la liste qui fait ça ? Tu es sûr ?

    Citation Envoyé par iman iza
    Puis si t'as une idée sur COCOON d’apache et si il peut m’être utile en quelque chose dans ce que je veux faire (xml +xsl ->pdf)
    Effectivement, Cocoon peut faire ça. Il le fait en appelant un moteur XSLT puis FOP -_-°.
    Ce sera bien plus simple en le faisant toi-même, je t'assure.
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  17. #17
    Futur Membre du Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2014
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 33
    Localisation : Autre

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 13
    Points : 8
    Points
    8
    Par défaut
    je suis arrivé à générer mon xhtml et puis à le convertir à un PDF (enfin ) mais ce dernier ne reste pas 4 minutes (je n'arrive pas à l'ouvrir) puis la console génère ces erreurs.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
     
    C:\Users\iza\.fop\fop-1.1-bin\fop-1.1>fop -fo rapport.xhtml -pdf rapport
    .pdf
    23 mai 2014 16:02:48 org.apache.fop.cli.Main startFOP
    GRAVE: Exception
    javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException:
     First element must be the fo:root formatting object. Found (Namespace URI: "htt
    p://www.w3.org/1999/xhtml", Local Name: "html") instead. Please make sure you're
     producing a valid XSL-FO document.
            at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:303)
            at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
            at org.apache.fop.cli.Main.startFOP(Main.java:177)
            at org.apache.fop.cli.Main.main(Main.java:208)
    Caused by: javax.xml.transform.TransformerException: org.apache.fop.fo.Validatio
    nException: First element must be the fo:root formatting object. Found (Namespac
    e URI: "http://www.w3.org/1999/xhtml", Local Name: "html") instead. Please make
    sure you're producing a valid XSL-FO document.
            at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transf
    ormerIdentityImpl.java:501)
            at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:300)
            ... 3 more
    Caused by: org.apache.fop.fo.ValidationException: First element must be the fo:r
    oot formatting object. Found (Namespace URI: "http://www.w3.org/1999/xhtml", Loc
    al Name: "html") instead. Please make sure you're producing a valid XSL-FO docum
    ent.
            at org.apache.fop.events.ValidationExceptionFactory.createException(Vali
    dationExceptionFactory.java:38)
            at org.apache.fop.events.EventExceptionManager.throwException(EventExcep
    tionManager.java:58)
            at org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBr
    oadcaster.java:175)
            at com.sun.proxy.$Proxy0.invalidFORoot(Unknown Source)
            at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuil
    der.java:259)
            at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)
            at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(Tra
    nsformerIdentityImpl.java:1072)
            at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour
    ce)
            at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Sourc
    e)
            at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Sourc
    e)
            at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
    own Source)
            at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.s
    canRootElementHook(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
    Dispatcher.dispatch(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
    known Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
            at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
            at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Sour
    ce)
            at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transf
    ormerIdentityImpl.java:484)
            ... 4 more
     
    ---------
     
    javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException:
     First element must be the fo:root formatting object. Found (Namespace URI: "htt
    p://www.w3.org/1999/xhtml", Local Name: "html") instead. Please make sure you're
     producing a valid XSL-FO document.
            at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transf
    ormerIdentityImpl.java:501)
            at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:300)
            at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
            at org.apache.fop.cli.Main.startFOP(Main.java:177)
            at org.apache.fop.cli.Main.main(Main.java:208)
    Caused by: org.apache.fop.fo.ValidationException: First element must be the fo:r
    oot formatting object. Found (Namespace URI: "http://www.w3.org/1999/xhtml", Loc
    al Name: "html") instead. Please make sure you're producing a valid XSL-FO docum
    ent.
            at org.apache.fop.events.ValidationExceptionFactory.createException(Vali
    dationExceptionFactory.java:38)
            at org.apache.fop.events.EventExceptionManager.throwException(EventExcep
    tionManager.java:58)
            at org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBr
    oadcaster.java:175)
            at com.sun.proxy.$Proxy0.invalidFORoot(Unknown Source)
            at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuil
    der.java:259)
            at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)
            at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(Tra
    nsformerIdentityImpl.java:1072)
            at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour
    ce)
            at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Sourc
    e)
            at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Sourc
    e)
            at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
    own Source)
            at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.s
    canRootElementHook(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
    Dispatcher.dispatch(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
    known Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
            at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
            at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Sour
    ce)
            at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transf
    ormerIdentityImpl.java:484)
            ... 4 more
    ---------
    org.apache.fop.fo.ValidationException: First element must be the fo:root formatt
    ing object. Found (Namespace URI: "http://www.w3.org/1999/xhtml", Local Name: "h
    tml") instead. Please make sure you're producing a valid XSL-FO document.
            at org.apache.fop.events.ValidationExceptionFactory.createException(Vali
    dationExceptionFactory.java:38)
            at org.apache.fop.events.EventExceptionManager.throwException(EventExcep
    tionManager.java:58)
            at org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBr
    oadcaster.java:175)
            at com.sun.proxy.$Proxy0.invalidFORoot(Unknown Source)
            at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuil
    der.java:259)
            at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:175)
            at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(Tra
    nsformerIdentityImpl.java:1072)
            at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Sour
    ce)
            at org.apache.xerces.xinclude.XIncludeHandler.startElement(Unknown Sourc
    e)
            at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Sourc
    e)
            at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unkn
    own Source)
            at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.s
    canRootElementHook(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent
    Dispatcher.dispatch(Unknown Source)
            at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Un
    known Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
            at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
            at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
            at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Sour
    ce)
            at org.apache.xalan.transformer.TransformerIdentityImpl.transform(Transf
    ormerIdentityImpl.java:484)
            at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:300)
            at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:130)
            at org.apache.fop.cli.Main.startFOP(Main.java:177)
            at org.apache.fop.cli.Main.main(Main.java:208)
    Est-ce une erreur liée à l’entête?

  18. #18
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 551
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 551
    Points : 21 607
    Points
    21 607
    Par défaut
    Non, c'est une erreur liée au fait que tu lui dis, "tiens, utilise ce document XSL-FO" et que tu lui donnes un document XHTML à la place.
    Tu n'as pas de document XSL-FO. Ne lui dis pas que tu en as -_-°.
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  19. #19
    Futur Membre du Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2014
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 33
    Localisation : Autre

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 13
    Points : 8
    Points
    8
    Par défaut
    Donc je dois convertir mon xhtml en xsl-fo

  20. #20
    Futur Membre du Club
    Femme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2014
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 33
    Localisation : Autre

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Finance

    Informations forums :
    Inscription : Mai 2014
    Messages : 13
    Points : 8
    Points
    8
    Par défaut
    Merciiii thelvin j'ai résolu mon problème

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème avec org.apache.axis.client.invoke()
    Par safi11 dans le forum Développement Web en Java
    Réponses: 0
    Dernier message: 23/08/2010, 11h38
  2. Problème avec org.apache.struts.taglib
    Par newmar dans le forum Struts 1
    Réponses: 1
    Dernier message: 22/02/2008, 16h55
  3. Problème avec org.apache.maven.skins
    Par romaintaz dans le forum Maven
    Réponses: 8
    Dernier message: 07/11/2007, 08h42
  4. Problème avec org.apache.log4j.jdbc.JDBCAppender
    Par dondano dans le forum Logging
    Réponses: 1
    Dernier message: 17/08/2007, 21h54
  5. Probléme avec org.apache.axis.utils.JavaUtils.convert
    Par adil_aeh dans le forum Services Web
    Réponses: 1
    Dernier message: 22/06/2007, 15h57

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo