Source source = new SAXSource(xmlreader, input);
Eagle eagle = (Eagle) unmarshaller.unmarshal(source);
Drawing drawing = (Drawing) eagle.getCompatibilityOrDrawing().get(0);
Library library = (Library) drawing.getLibraryOrSchematicOrBoard().get(0);
Packages packages = library.getPackages();
HashSet<Object> stuff = new HashSet<Object>();
System.out.println("<openpnp-packages>");
for (Package pkg : packages.getPackage()) {
System.out.println(String.format("<package id=\"%s\" name=\"%s\">", pkg.getName(), pkg.getName()));
System.out.println(String.format("<footprint units=\"Millimeters\">"));
for (Object o : pkg.getPolygonOrWireOrTextOrDimensionOrCircleOrRectangleOrFrameOrHoleOrPadOrSmd()) {
if (o instanceof Smd) {
Smd smd = (Smd) o;