XML verstehen – das vielseitige Markup-Datenformat

tiny-tool.de

tiny-tool.de

XML (Extensible Markup Language) ist ein universelles Datenformat, das in der modernen IT-Welt weiterhin eine wichtige Rolle spielt. Als strukturierter, menschen- und maschinenlesbarer Standard wird es unter anderem in Webservices, Office-Dokumenten, APIs, Konfigurationsdateien und Vektorgrafiken eingesetzt.

Grundlagen von XML

XML wurde vom World Wide Web Consortium (W3C) entwickelt, um strukturierte Daten plattformunabhängig zu speichern und zu übertragen. XML trennt strikt Inhalt und Darstellung und eignet sich ideal für den Datenaustausch zwischen verschiedenen Systemen.

Im Gegensatz zu binären Formaten ermöglicht XML eine nachvollziehbare Beschreibung von Inhalten, die auch ohne spezielle Tools lesbar bleibt. XML ist sowohl in Entwicklungsumgebungen als auch direkt im Texteditor einfach zu analysieren oder anzupassen.

Aufbau und Struktur

Ein XML-Dokument beginnt stets mit einer Deklaration, welche die Version und Kodierung angibt. Danach folgt eine hierarchische Baumstruktur aus Elementen. Jedes Element besitzt Start- und End-Tags und kann wiederum verschachtelte Elemente, Textinhalte und Attribute enthalten.

Werbung/Advertising

<

AVG Ultimate

AVG Ultimate

Preis: 25,00 EUR

Zum Angebot

AVG Internet Security

AVG Internet Security

Preis: 25,00 EUR

Zum Angebot

Office 2019 Home and Business

Office 2019 Home and Business

Preis: 19,90 EUR

Zum Angebot

Panda Dome Advanced MD

Panda Dome Advanced MD

Preis: 15,00 EUR

Zum Angebot

CorelCAD 2021 Upgrade Windows/Mac ESD

CorelCAD 2021 Upgrade Windows/Mac ESD

Preis: 180,00 EUR

Zum Angebot

Microsoft Word 2016

Microsoft Word 2016

Preis: 14,90 EUR

Zum Angebot

Windows Server 2016 CALS

Windows Server 2016 CALS

Preis: 64,90 EUR

Zum Angebot

McAfee Internet Security

McAfee Internet Security

Preis: 25,00 EUR

Zum Angebot

Windows 10 Home

Windows 10 Home

Preis: 14,90 EUR

Zum Angebot

Windows 11 Home

Windows 11 Home

Preis: 19,90 EUR

Zum Angebot

Panda Dome Essential MD

Panda Dome Essential MD

Preis: 15,00 EUR

Zum Angebot

Windows Server 2022 CALS

Windows Server 2022 CALS

Preis: 99,90 EUR

Zum Angebot

AVG TuneUp ESD

AVG TuneUp ESD

Preis: 25,00 EUR

Zum Angebot

Office 2019 Professional

Office 2019 Professional

Preis: 39,90 EUR

Zum Angebot

Visio 2016 Professional

Visio 2016 Professional

Preis: 14,90 EUR

Zum Angebot

Office 2021 Home and Business

Office 2021 Home and Business

Preis: 24,90 EUR

Zum Angebot

Microsoft Office 2021 Standard

Microsoft Office 2021 Standard

Preis: 24,90 EUR

Zum Angebot

Microsoft Excel 2019

Microsoft Excel 2019

Preis: 14,90 EUR

Zum Angebot

McAfee Total Protection

McAfee Total Protection

Preis: 15,00 EUR

Zum Angebot

Visio 2019 Professional

Visio 2019 Professional

Preis: 14,90 EUR

Zum Angebot

McAfee VPN Safe Connect

McAfee VPN Safe Connect

Preis: 30,00 EUR

Zum Angebot

Office 2021 Professional

Office 2021 Professional

Preis: 19,90 EUR

Zum Angebot

Windows 10/11 Home

Windows 10/11 Home

Preis: 14,90 EUR

Zum Angebot

Microsoft Office 2019 Standard

Microsoft Office 2019 Standard

Preis: 19,90 EUR

Zum Angebot

mySteganos Online Shield VPN

mySteganos Online Shield VPN

Preis: 55,00 EUR

Zum Angebot

Office 2024 Home

Office 2024 Home

Preis: 44,90 EUR

Zum Angebot

Adobe Acrobat Standard 2020 OEM

Adobe Acrobat Standard 2020 OEM

Preis: 900,00 EUR

Zum Angebot

Microsoft Excel 2021

Microsoft Excel 2021

Preis: 19,90 EUR

Zum Angebot

Office 2024 Professional Plus

Office 2024 Professional Plus

Preis: 29,99 EUR

Zum Angebot

Windows 11 Pro

Windows 11 Pro

Preis: 14,90 EUR

Zum Angebot

Office 2021 Professional Plus f?r 3 Ger?te

Office 2021 Professional Plus f?r 3 Ger?te

Preis: 23,50 EUR

Zum Angebot

Bitdefender Premium VPN

Bitdefender Premium VPN

Preis: 90,00 EUR

Zum Angebot

ESET NOD32 Antivirus

ESET NOD32 Antivirus

Preis: 50,00 EUR

Zum Angebot

Microsoft Windows Server 2022 Datacenter

Microsoft Windows Server 2022 Datacenter

Preis: 219,00 EUR

Zum Angebot

Windows 10/11 Pro

Windows 10/11 Pro

Preis: 19,90 EUR

Zum Angebot

Office 2021 Home and Student

Office 2021 Home and Student

Preis: 19,90 EUR

Zum Angebot

Windows Server Standard 2022

Windows Server Standard 2022

Preis: 194,90 EUR

Zum Angebot

Microsoft Word 2019

Microsoft Word 2019

Preis: 14,90 EUR

Zum Angebot

Windows 10 Pro

Windows 10 Pro

Preis: 14,90 EUR

Zum Angebot

Microsoft Powerpoint 2019

Microsoft Powerpoint 2019

Preis: 29,90 EUR

Zum Angebot

Windows Server 2019 CALS

Windows Server 2019 CALS

Preis: 87,90 EUR

Zum Angebot

Microsoft Windows Server 2022

Microsoft Windows Server 2022

Preis: 349,90 EUR

Zum Angebot

Avast Premium Security

Avast Premium Security

Preis: 20,00 EUR

Zum Angebot

Pinnacle Studio 26 (2023) STANDARD Windows / Deutsch

Pinnacle Studio 26 (2023) STANDARD Windows / Deutsch

Preis: 110,00 EUR

Zum Angebot

Office 2021 Professional Plus + Windows 11 Professional Bundle

Office 2021 Professional Plus + Windows 11 Professional Bundle

Preis: 24,90 EUR

Zum Angebot

Watchdog Anti-Malware Vollversion

Watchdog Anti-Malware Vollversion

Preis: 25,00 EUR

Zum Angebot

Adobe Photoshop Elements 2025

Adobe Photoshop Elements 2025

Preis: 190,00 EUR

Zum Angebot

Office 2024 Professional

Office 2024 Professional

Preis: 39,90 EUR

Zum Angebot

Office 2019 Professional Plus

Office 2019 Professional Plus

Preis: 14,90 EUR

Zum Angebot

Office 2019 Professional plus

Office 2019 Professional plus

Preis: 39,90 EUR

Zum Angebot

Microsoft Word 2021

Microsoft Word 2021

Preis: 14,90 EUR

Zum Angebot

Office 2021 Professional Plus + Windows 11 Professional GRATIS

Office 2021 Professional Plus + Windows 11 Professional GRATIS

Preis: 24,90 EUR

Zum Angebot

Office 2016 Home and Student

Office 2016 Home and Student

Preis: 14,90 EUR

Zum Angebot

Office 2021 Professional Plus

Office 2021 Professional Plus

Preis: 19,90 EUR

Zum Angebot

Trend Micro Antivirus + Security

Trend Micro Antivirus + Security

Preis: 20,00 EUR

Zum Angebot

Windows Server 2016 RDS CALS

Windows Server 2016 RDS CALS

Preis: 64,90 EUR

Zum Angebot

Norton 360 Deluxe inkl. 25GB MD

Norton 360 Deluxe inkl. 25GB MD

Preis: 25,00 EUR

Zum Angebot

Windows Server 2016

Windows Server 2016

Preis: 99,90 EUR

Zum Angebot

Office 2016 Home and Business

Office 2016 Home and Business

Preis: 14,90 EUR

Zum Angebot

Kaspersky Mobile

Kaspersky Mobile

Preis: 25,00 EUR

Zum Angebot

Office 2019 Home and Student

Office 2019 Home and Student

Preis: 19,90 EUR

Zum Angebot

Windows Server 2022 RDS CALS

Windows Server 2022 RDS CALS

Preis: 109,90 EUR

Zum Angebot

Windows Server 2019 RDS CALS

Windows Server 2019 RDS CALS

Preis: 93,90 EUR

Zum Angebot

Office 2016 Professional

Office 2016 Professional

Preis: 14,90 EUR

Zum Angebot

Panda Dome Complete MD

Panda Dome Complete MD

Preis: 25,00 EUR

Zum Angebot

Bitdefender Antivirus Plus

Bitdefender Antivirus Plus

Preis: 50,00 EUR

Zum Angebot
>

Einfaches XML-Beispiel

<?xml version="1.0" encoding="UTF-8"?>
<buecher>
  <buch>
    <titel>Die Kunst der XML</titel>
    <autor>Max Mustermann</autor>
    <veroeffentlichungsjahr>2023</veroeffentlichungsjahr>
  </buch>
</buecher>

In diesem Beispiel beschreibt das Element buch ein Buch mit Titel, Autor und Erscheinungsjahr. Diese Struktur zeigt, wie XML Informationen in einer klaren, lesbaren Form darstellt.

Verschachtelung von Elementen

<?xml version="1.0" encoding="UTF-8"?>
<bibliothek>
  <buecher>
    <buch>
      <titel>XML Grundlagen</titel>
      <autor>Max Mustermann</autor>
      <veroeffentlichungsjahr>2023</veroeffentlichungsjahr>
    </buch>
    <buch>
      <titel>Fortgeschrittenes XML</titel>
      <autor>Erika Musterfrau</autor>
      <veroeffentlichungsjahr>2025</veroeffentlichungsjahr>
    </buch>
  </buecher>
</bibliothek>

Hier sind mehrere buch-Elemente in einem gemeinsamen buecher-Element verschachtelt, welches wiederum in bibliothek eingebettet ist. Dies verdeutlicht die Fähigkeit von XML, komplexe Datenstrukturen abzubilden.

Verwendung von Attributen

<?xml version="1.0" encoding="UTF-8"?>
<buecher>
  <buch format="eBook" sprache="de">
    <titel>XML leicht gemacht</titel>
    <autor>Lena Beispiel</autor>
    <veroeffentlichungsjahr>2024</veroeffentlichungsjahr>
  </buch>
  <buch format="Hardcover" sprache="en">
    <titel>Mastering XML</titel>
    <autor>John Doe</autor>
    <veroeffentlichungsjahr>2022</veroeffentlichungsjahr>
  </buch>
</buecher>

Attribute wie format und sprache bieten eine kompakte Möglichkeit, zusätzliche semantische Informationen direkt im Element-Tag zu speichern.

XML in Konfigurationsdateien

<?xml version="1.0" encoding="UTF-8"?>
<databaseConfig>
  <host>localhost</host>
  <port>5432</port>
  <username>admin</username>
  <password>geheim</password>
</databaseConfig>

XML ist besonders geeignet, um Konfigurationen für Anwendungen (z. B. Java EE, Spring, Android) zu speichern, da es eine klare Trennung zwischen Code und Einstellungen erlaubt.

Namespaces in XML

<?xml version="1.0" encoding="UTF-8"?>
<buch xmlns="http://example.org/books" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://example.org/books book.xsd">
  <titel>XML Advanced</titel>
  <autor>Anna Schmidt</autor>
  <veroeffentlichungsjahr>2025</veroeffentlichungsjahr>
</buch>

Namespaces ermöglichen es, unterschiedliche XML-Vokabulare eindeutig zu identifizieren und Namenskonflikte zu vermeiden, besonders nützlich in Webservices oder komplexen Dokumentformaten wie DOCX.

XML-Schema zur Validierung

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="buch">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="titel" type="xs:string"/>
        <xs:element name="autor" type="xs:string"/>
        <xs:element name="veroeffentlichungsjahr" type="xs:gYear"/>
      </xs:sequence>
      <xs:attribute name="format" type="xs:string" use="optional"/>
    </xs:complexType>
  </xs:element>
</xs:schema>

XML-Schemas definieren exakt, welche Elemente und Attribute in einem XML-Dokument zulässig sind, und ermöglichen die automatische Validierung.

Erweiterte XML-Technologien

Zusätzlich zu den Grundfunktionen bieten folgende Technologien weiterführende Möglichkeiten zur Arbeit mit XML:

  • XPath – Abfragesprache zum Navigieren durch XML-Daten
  • XSLT – Transformiert XML-Daten z. B. in HTML
  • XQuery – Komplexe Abfragen über XML-Datenbestände

Fazit

XML bleibt ein bewährter Standard, dessen Stärke insbesondere in der klaren Struktur, Erweiterbarkeit, Validierbarkeit und plattformübergreifenden Nutzbarkeit liegt. Trotz Konkurrenz durch JSON bleibt XML besonders für komplexe und langlebige Datenstrukturen unverzichtbar.

Werbung/Advertising

Aromatico

Weiterführende Ressourcen