Here we are going to cover XML Elements, Tags and Attributes. You can watch our video to learn XML Elements, Tags and Attributes – click here.
Q . What is element in xml?
Ans. Elements are building blocks of an XML. Each element has a start tag and an end tag with your content in between
Q. What is XML document?
Ans. XML document contains one or more elements. They are the actual containers for your data or content.
Q . What is tag?
- XML tags begin with less-than character (“<”) and end with greater-than character (“>”).
- All element have a start tag and a end tag.
- A start tag has name inside angle brackets.
- End tag has the same name but with a preceding slash.
Q . What is difference between html tag and xml tag?
|html tag||xml tag|
|HTML tags are predefined tags.||XML tags are user defined tags.|
|There are limited number of tags in HTML.||XML tags are extensible.|
|HTML tags are used for displaying the data.||XML tags are used for describing the data not for displaying.|
|In HTML, closing tags are not necessary.||In XML, closing tags are necessary.|
Q . What are attribute?
Ans. Attribute is the property setting of the element. Attributes are defined through name -value pairs. All attribute values must be enclosed in quotation marks; single or double.
Q . What are the naming rules for tags and attributes in xml?
- XML is case sensitive
- Spaces are not allowed in names.
- Names cannot start with string “xml”
- Names start with letter or underscore.
- Rest can consist of letters, digits, underscore, dot(.)or a hyphen (-)
- By convention – HTML element in XML are written in uppercase ,and XML elements are written in lowercase