Basic XML Syntax Example
Xml / / April 02, 2023
XML is a markup language used to store and send structured data. The basic syntax of XML is made up mainly of elements and attributes. In this article we will review both.
Elements in XML are blocks of information that are used to represent structured data, and are made up of a start tag, the content, and a closing tag.
The start tag and end tag are always delimited by angle brackets "", and are usually composed of a name that identifies the element, for example:
Code:
Article content
- • What are XML tags and their examples
- • What are attributes in XML and their examples
- • Example of basic code syntax in XML
What are XML tags and their examples
Tags in XML are used to define elements and attributes. Elements are blocks of information with a name and associated content. Tags in XML are always enclosed in angle brackets "". For example:
Code:
In this example, "name" is the name of the element, and "Mau del Moral" is the content of the element. Elements in XML must be closed with a corresponding closing tag, which is similar to the opening tag but with a forward slash “/” before the element name:
Code:
What are attributes in XML and their examples
XML attributes are used to provide additional information about elements. They are written inside the opening tag of an element and follow the "name=value" syntax. For example, the following XML includes an "age" attribute on the "person" element:
Code:
In this example, "age" is the name of the attribute, and "30" is its value.
Example of basic code syntax in XML
Code:
Quoted APA: Del Moral, M. & Rodriguez, J. (s.f.). Example of Basic XML Syntax.Example of. Retrieved on March 31, 2023 from https://www.ejemplode.com/21-xml/5293-ejemplo_de_sintaxis_basica_de_xml.html