简体   繁体   English

从大型XML文件中删除不可打印和/或Unicode字符

[英]Removing non-printable and/or unicode chararacters from large XML-file

I have a method which receives a File object, containing XML-data. 我有一个方法来接收包含XML数据的File对象。 Files can be over 50 MB. 文件可以超过50 MB。 Is there a convenient way to remove control chars and/or non-printable chars from it. 是否有一种方便的方法可以从中删除控制字符和/或不可打印的字符。

For smaller files I read the File contents to String and use replaceAll("\\p{Cntrl}", ""). 对于较小的文件,我将文件内容读取为String并使用replaceAll(“ \\ p {Cntrl}”,“”)。

1). 1)。 Use notepad++ or ms word and use find/replace 2) Write java program using bufferedStream find and replace the stringtokens 使用notepad ++或ms单词并使用查找/替换2)使用bufferedStream编写Java程序以查找并替换stringtokens

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM