List of usage examples for org.dom4j Element elementIterator
Iterator<Element> elementIterator(QName qName);
From source file:lineage2.gameserver.data.xml.parser.SpawnParser.java
License:Open Source License
/** * Method parseTerritory./*from w w w. jav a 2 s. co m*/ * @param name String * @param e Element * @return Territory */ private Territory parseTerritory(String name, Element e) { Territory t = new Territory(); t.add(parsePolygon0(name, e)); for (Iterator<Element> iterator = e.elementIterator("banned_territory"); iterator.hasNext();) { t.addBanned(parsePolygon0(name, iterator.next())); } return t; }
From source file:lineage2.gameserver.data.xml.parser.SpawnParser.java
License:Open Source License
/** * Method parsePolygon0.//from ww w .j ava2s . c om * @param name String * @param e Element * @return Polygon */ private Polygon parsePolygon0(String name, Element e) { Polygon temp = new Polygon(); for (Iterator<Element> addIterator = e.elementIterator("add"); addIterator.hasNext();) { Element addElement = addIterator.next(); int x = Integer.parseInt(addElement.attributeValue("x")); int y = Integer.parseInt(addElement.attributeValue("y")); int zmin = Integer.parseInt(addElement.attributeValue("zmin")); int zmax = Integer.parseInt(addElement.attributeValue("zmax")); temp.add(x, y).setZmin(zmin).setZmax(zmax); } if (!temp.validate()) { error("Invalid polygon: " + name + "{" + temp + "}. File: " + getCurrentFileName()); } return temp; }