Note that there are some explanatory texts on larger screens.

plurals
  1. PONUL character in xml file (using dom4j)
    primarykey
    data
    text
    <p>I am using dom4j to extract information in xml files(all in one folder). Here's my code:</p> <pre><code> File folder = new File("c:/folder directory"); File[] listOfFiles = folder.listFiles(); FileOutputStream foutstream = new FileOutputStream("c:/mozilla_expertlist.txt",true); PrintWriter writer = new PrintWriter(foutstream); for (File file: listOfFiles) { System.out.println(file.getName()); File f = new File("c:/Users/dahuo2013/workspace/mozilla_xml/"+file.getName()); SAXReader reader = new SAXReader(); reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); reader.setEncoding("utf-8"); Document doc = reader.read(f); Element root = doc.getRootElement(); Element foo; for (Iterator i = root.elementIterator("bug"); i.hasNext();) { foo = (Element) i.next(); writer.println(foo.elementText("assigned_to")); } } writer.close(); </code></pre> <p>My code is working however it always have errors reporting. Then I found that when the xml file has NUL NUL NUL characters. It shows error. When I delete those NUL characters. It will definitely work.</p> <p>But I have more than 4000 xml files in the folder.I cannot delete those NUL one by one by my hands. My xml is encoded by utf-8. Is there any easy way to avoid those NUL characters? Or what kind of easy solution can delete those NUL characters?</p> <p>Thanks!</p> <p>also:</p> <p><img src="https://i.stack.imgur.com/PF2fx.png" alt="enter image description here"></p> <p>This is the NUL character. I opened in notepad++</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload