Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com

First, create a JAXP factory.

Then a document builder,...

in this case an Apache Xerces implementation.

The XML file to be parsed.

Parse the file.

Any children ?

First one.

Its sibling, the second child.

This child's, the root, nodes, using a NodeList.

How to get an attribute.

Retrieve an element's name and text content.

aliment2's first (and only) child is a text node.

Some more methods for you to figure out,...

where this one's especially useful.

It returns a NodeList, however.

Parsing errors are handled by our SAXHandler.

This is set up, so errors are logged...

in a file,...

as plain text (not XML).