XML elements
- Last Updated: February 17, 2025
- 1 minute read
- OpenEdge
- Version 12.2
- Documentation
Elements represent the logical components of documents. They can contain data or other elements. For example, a customer element can contain a number of column (field) elements and each column element can contain one data value. An element is composed of a start tag, data, and an end tag. Here is an example of an element:
|
Here is an example of elements that contain other elements:
|
In this example, name and extension are
child elements of entry, which is a child element
of phone. Similarly, phone is
a parent element of entry, which is a parent element
of name and extension.
The top-level element, the one that is the parent of all other
elements is referred to as the root element. A child
element that cannot have its own child elements, as defined by the
DTD or XML Schema, is referred to as a leaf element.
In the example above, name and extension are
leaf elements.
To conclude, a typical discussion of XML elements that describes hierarchy will use these terms:
- Root element
- Parent element
- Child element
- Leaf element
In the previous example, the XML contains whitespace to make the logical, hierarchical structure of the XML apparent to human readers. XML is valid with or without this whitespace. The following version is also valid XML:
|