Salve ragazzi sto utilizzando la classe tidy, per pulire un file xml,
però durante questo processo tidy mi segnala degli errori, e il file
xml non viene pulito, gli errori, sono questi:
line 2 column 1 - Error: <nome_tag> is not recognized!
line 2 column 1 - Warning: discarding unexpected <nome_tag>
Questi errori si ripetono per tutti i tag del file xml, invece il
codice che ho utilizzato per usare il tidy è questo:
Spero che qualcuno voglia aiutarmi a capire perchè la mia classe tidy,codice:public UtilTidy (String url, String outFileName,String errOutFileName, boolean xmlOut, boolean XmlPi, boolean RawOut, boolean XmlTags, boolean IndentContent, boolean XHTML ) { this.url = url; this.outFileName = outFileName; this.errOutFileName = errOutFileName; this.xmlOut = xmlOut; this.XmlPi = XmlPi; this.RawOut = RawOut; this.XmlTags = XmlTags; this.IndentContent = IndentContent; this.XHTML = XHTML; } public void run() { File file; URL u; BufferedInputStream in; FileOutputStream out; Tidy tidy = new Tidy(); tidy.setXmlOut(xmlOut); tidy.setXmlPi(XmlPi); tidy.setRawOut(RawOut); tidy.setXmlTags(XmlTags); tidy.setIndentContent(IndentContent); tidy.setXHTML(XHTML); tidy.setCharEncoding(org.w3c.tidy.Configuration.UTF8); try { tidy.setErrout(new PrintWriter(new FileWriter(errOutFileName), true)); file= new File(url); u = file.toURL(); in = new BufferedInputStream(u.openStream()); out = new FileOutputStream(outFileName); tidy.parse(in, out); in.close(); out.close(); } catch ( IOException e ) { System.out.println( this.toString() + e.toString() ); } } public static void main( String[] args ) throws Exception { UtilTidy a = new UtilTidy(); a.runTidy ("C:/sorgente.xml", "C:/destinazione.xml", "C:/errorTidy.txt",true,true,true,false,true,false); }
non funziona correttamente, grazie a tutti :-)

Rispondi quotando