1. Introduction


What is XML?

XML stands for extensible markup language. It is like HTML based on tags and inherits the Document Object Modell (DOM). Tags can have parent- and child-tags. This can be seen as a kind of object-orientation.

Obligatory for a XML-File is the first line:

<?xml version="1.0"?>

You have to put this line into your XML-File as a first line. Otherwise it will not be identified as a XML-File.

<?xml version="1.0" encoding="UTF-8"?>

You can alter it like that. As it is encoded as "UTF-8" this means that especially German characters, which are not included in the English alphabet, are now supported and readable.

This is an example of XML:

<person>
  <name>Fred Feuerstein</name>
  <age>40</age>
  <wife>Wilma</wife>
  <friend>Barney</friend>
</person>

As you can see, person is the parent. Name, age, wife and friend are child-tags of person. If you think of Java, person can be seen as a class, which contains the variables name, age, wife and friend. An indivuell object of that class will be instantiated with all the necessary variables.

To save and get returned all the information needed for a person, it is also possible to make the person look like this:

<person name="Fred Feuerstein" age="40" wife="Wilma" friend="Barney">
</person>

It contains all the necessary information, but it is organized differenty. As you can see you can put the child-tags as attributes into the first tag. On the next sites you will see that the return of the information will be programmed slightly differently.

In terms of organisation and "eye-friendliness" it is recommended not to overload the parent-tag person, especially for bigger projects.

XML is nowadays widely used in many softwares. Examples are the "web.xml" in Java EE-Applications, the "pom.xml" in Maven Applications and the layout-file in Android-Applications. But it is also possible to use XML-Files to save and retrieve information of PC-Users stored on their computer. This replaces, for example, simple textfiles or helps not to overcomplicate it with databases if a data

What is JAXP?

JAXP stands for Java API for XML Processing. This is the standard reference when it comes to XML Processing in Java. You do not have to use external libraries. It is integrated in the Standard API.

During the next sites you will see common cases when to use it.