1
0
Fork 0
mirror of https://github.com/crawler-commons/crawler-commons synced 2024-05-20 02:26:03 +02:00

SAX parser to stop URL at closing </loc> fixes #153

This commit is contained in:
Julien Nioche 2017-06-05 16:58:39 +01:00
parent 2c72ba8708
commit 7bf499a98a

View File

@ -70,6 +70,10 @@ class XMLHandler extends DelegatorHandler {
}
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
// flush any unclosed or missing URL element
if (loc.length() > 0 && ("loc".equals(qName) || "url".equals(qName))) {
maybeAddSiteMapUrl();
}
}
public void endElement(String uri, String localName, String qName) throws SAXException {