Search in sources :

Example 1 with XMLSimpleNodeException

use of org.wikivoyage.listings.utils.XMLSimpleNodeException in project wikivoyage-listings by baturin.

the class NavigationXMLOutputFormat method write.

@Override
public void write(Iterable<Listing> pois, String outputFilename, String dumpDate) throws WriteOutputException {
    try {
        LinkedList<Listing> filteredPois = new LinkedList<>();
        for (Listing poi : pois) {
            if (!poi.isPositionalDataEmpty()) {
                // POIs with no positional data are useless for navigation - do not add them
                // to reduce size of output file
                filteredPois.add(poi);
            }
        }
        Listing[] filteredPoisArr = filteredPois.toArray(new Listing[filteredPois.size()]);
        XMLSimpleNode rootNode = createXml(filteredPoisArr, dumpDate);
        rootNode.writeToFile(outputFilename);
    } catch (XMLSimpleNodeException e) {
        throw new WriteOutputException();
    }
}
Also used : XMLSimpleNode(org.wikivoyage.listings.utils.XMLSimpleNode) Listing(org.wikivoyage.listings.entity.Listing) XMLSimpleNodeException(org.wikivoyage.listings.utils.XMLSimpleNodeException) LinkedList(java.util.LinkedList)

Aggregations

LinkedList (java.util.LinkedList)1 Listing (org.wikivoyage.listings.entity.Listing)1 XMLSimpleNode (org.wikivoyage.listings.utils.XMLSimpleNode)1 XMLSimpleNodeException (org.wikivoyage.listings.utils.XMLSimpleNodeException)1