private void scruffit(Document document) throws XPathExpressionException {
        Element root = document.getDocumentElement();

        XPathExpression xPathExpression = xml.compileXPath("descendant::*[parent::g[@class = 'node']]");
        NodeList evaluate = (NodeList)xPathExpression.evaluate(root, XPathConstants.NODESET);

        // skip the first node
        for(int i=1;i<evaluate.getLength();i++) {
            Element element = (Element)evaluate.item(i);
            String tagName = element.getTagName();
            if("polygon".equals(tagName)) {
                scruffPolygon(element);
            }
            else if("polyline".equals(tagName)){
                scruffPolyline(element);
            }
        }
    }