O'Reilly logo

Java Programming for Beginners by Mark Lassoff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Accessing Jane's XML element

This section will help us access the information about the cars owned by Jane, using the following code. I have divided the code to be added to our main() function in six parts:

  1. So, in the pursuit of finding all the cars owned by Jane, let's see what functionality our XML document provides for us right off the bat. If we take a look at code completion to quickly scan through our list of methods, we can call dom from our Document instance. We're going to see the getDocumentElement() method return an element for us:

This is probably a good way to start. This method returns the top-level element in our XML; in ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required