Skip to content

Commit

Permalink
Enhance XMl reader (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosthe19916 authored Dec 17, 2022
1 parent 11215ad commit 200d673
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

import org.xml.sax.SAXException;

import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
Expand All @@ -32,10 +34,14 @@ private XmlContentProvider() {

public static XmlContent getSunatDocument(InputStream is) throws ParserConfigurationException, SAXException, IOException {
XmlHandler handler = new XmlHandler();

SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
factory.setNamespaceAware(true);

SAXParser parser = factory.newSAXParser();
parser.parse(is, handler);

return handler.getModel();
}
}

0 comments on commit 200d673

Please sign in to comment.