-2

In an HTML document there are HTML opening and closing tags: <html> </html> . Is this the same for XML?

For XML: <?xml version="1.0"?> does it need </xml> ?

I read here :https://www.w3schools.com/xml/xml_syntax.asp That the "The XML prolog does not have a closing tag". It seems confusing if and opening and closing tag are required for HTML ,but not XML. How does a machine know its at the end of the XML file?

1 Answers1

3

The XML declaration is not a tag. There is no end tag for it.

The XML document's root element will have a mandatory end tag. What tag that is will depend on the specific XML application (e.g. for Atom it will be <feed>...</feed>).

(The HTML element's end tag is optional, as is its start tag).

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • This is the correct answer (+1). See also [What is ``?](https://stackoverflow.com/q/45380229/290085) – kjhughes Apr 23 '20 at 00:51