public static void main(String[] args) throws Exception
{
Document doc = new Document("data/document.doc");
// This gets a live collection of all shape nodes in the document.
NodeCollection shapeCollection = doc.getChildNodes(NodeType.SHAPE, true);
// Since we will be adding/removing nodes, it is better to copy all collection
// into a fixed size array, otherwise iterator will be invalidated.
Node[] shapes = shapeCollection.toArray();
for (Node node : shapes)
{
Shape shape = (Shape)node;
// Filter out all shapes that we don't need.