List of usage examples for javax.xml.parsers DocumentBuilderFactory isExpandEntityReferences
public boolean isExpandEntityReferences()
From source file:importer.handler.post.stages.Splitter.java
/** * Split a TEI-XML file into versions of XML * @param tei the TEI file containing versions * @return a map of version names to XML files as strings * @throws ImportException if something went wrong *///from w w w. java 2 s. c o m public Map<String, String> split(String tei) throws ImporterException { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); if (dbf.isExpandEntityReferences()) dbf.setExpandEntityReferences(false); DocumentBuilder db = dbf.newDocumentBuilder(); StringReader sr = new StringReader(tei); InputSource is = new InputSource(sr); Document doc = db.parse(is); root = doc.getDocumentElement(); root.setAttribute(VERSIONS, BASE); prepare(root, new Cluster(discriminator)); percolateDown(root); //verifyRule1( root ); return XMLPrinter.splitAll(doc, discriminator.drops, discriminator.removals); } catch (Exception e) { throw new ImporterException(e); } }