Does HTML tags work in an XML file and why would you want to put html in a xml file?

So I’ve been looking for a while on here and google, but have been unable to find the answer to my question. I recently learned about XML and as I was doing some self-study, I’ve seen some people putting HTML code in their XML files. I am confused because I thought the main purpose of XML was for data transfer/manipulation and that any tags used in them are self created by whoever created the XML file. Would HTML tags even work in an XML file? And why would you want to put HTML in a XML? It seems like it might cause unneeded complexity to the code.

Edit 1. To clarify a few points, everything I’ve been learning is that HTML is about presentation of data and XML is for data transfer/manipulation, so it seems like you’ve got two methods that are doing different things. Also, in regards to HTML tags being used in XML files, tags like or which would apply specific styles or in the case of creating an actual table, would these work as expected? From what I understand, XML doesn’t have any of these predefined tags, so it would be kind of pointless to add these in. In this scenario, it seems this person was specifically using HTML tags, with the expectation that it would function as an HTML tag. This was an example found in google, FYI, I do not know this person personally.

Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.