[EMAIL PROTECTED] wrote:

Bonjour,
je ne m'y prends sûrement pas très bien...mais je ne sais plus comment faire!
Voilà, après avoir uploadé un fichier XML, je voudrais supprimer la déclaration 
de DOCTYPE, car la DTD fournie est fausse...
Pour cela, j'ai utilisé une classe java nommée DoctypeChanger

=>http://www.simonstl.com/projects/doctypes/DOCTYPEChangerStream.java

Ma sitemap:
[...]
<map:match pattern="modif">
  <map:call function="removeDoctype"/>
</map:match>

Mon flow script:
cocoon.load("resource://org/apache/cocoon/util/DOCTYPEChangerStream.java");

//Remove any existing doctype declaration
//This is done by always returning a null Doctype object //file.xml est le fichier uploader dont on veut supprimer la declaration du DOCTYPE
function removeDoctype() {
InputStream in = new BufferedInputStream (new FileInputStream("file.xml"));
DoctypeChangerStream changer = new DoctypeChangerStream(in);
changer.setGenerator(
new DoctypeGenerator() {
  public Doctype generate(Doctype old) {
   return null;
 }
} );
}

RESULTAT:
Cocoon me renvoie SyntaxError dans mon flow script des que je crée ma variable 
in.

Merci de votre aide.

Bérengère

En javascript, les variables ne sont pas typées. Il faut les déclarer avec : var
Exemple :


function removeDoctype() {
var in = new BufferedInputStream (new FileInputStream("file.xml"));
var changer = new DoctypeChangerStream(in);
changer.setGenerator(
new DoctypeGenerator() {
  public Doctype generate(Doctype old) {
   return null;
 }
} );
}

De plus, il faut ajouter le nom des packages pour chaque classe.

--
Philippe GASSMANN
Systèmes d'Information
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com/


---------------------------------------------------------------------
Liste francophone Apache Cocoon -- http://cocoon.apache.org/fr/
Pour vous desinscrire : mailto:[EMAIL PROTECTED]
Autres commandes : mailto:[EMAIL PROTECTED]

Répondre à