It's the right approach, but instead of assuming that each Node in the graph is a Shape3D, you should get it out of the Enumeration as a Node, and then check to see if it an instanceof Shape3D before forcing the cast.
At least that way you won't get a ClassCastException at runtime!!
You will want to also check for Group nodes, because then you will want to iterate through all of the children of the sub-group. I believe most of the VRML Loaders support nested Groups.
Here's an example SceneGraph to illustrate:
1 2 3 4 5 6 7 8 9 10 11
| BranchGroup +-- Shape3D +-- Shape3D +-- TransformGroup +-- Shape3D +-- Shape3D +-- TransformGroup +-- Shape3D +-- TransformGroup +-- Shape3D +-- etc, etc, etc... |
I am doing exactly the same thing in a ModelManager class, which supports loading several different types of Loaders (OBJ, VRML, and 3DS for now).