Home > technical, uml > XML In UML

XML In UML

While learning XML, I concocted this UML class diagram of the conceptual structure of XML as a quick look refresher guide:

The diagram can be interpreted as:

  • A typical XML document is composed of  a “Document Element“, an optional “Prolog Element”, and many application specific “Element” classes.
  • Besides a base “Element” class, there are two subclass types: the “Document Element” and the “Prolog Element”.
  • In an XML file, the “Prolog Element” (if present) must precede the “Document Element”.
  • An element contains content and, optionally, 1 or more “Attributes”.
  • Each “Attribute” is comprised of a Name/Value pair.
  • An element can also contain other nested elements, providing support for structured data representation.

Here’s a simple concrete example XML file and the mapping from concrete to abstract. Note that the “comment” and “xml declaration” lines aren’t represented in the abstract class diagram model. I left out that second order level of detail to keep the class diagram simple.

  1. No comments yet.
  1. No trackbacks yet.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.