Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Isn't it possible to use <a> tags in XML just like in HTML?

Tags:

html

css

xml

I am just practicing XML. I want to use the <a> tag in the XML document to make a link reference to another page.

like image 338
Ansul Avatar asked Sep 01 '25 04:09

Ansul


2 Answers

You can use an a element in XML like this:

<a href="pagetwo.html">Page two</a>

But XML doesn't say that this is a link. The semantics of what an <a> element means depend entirely on the particular XML vocabulary. This might be a link in one XML vocabulary, and something completely different in another. XML is just syntax.

like image 92
Michael Kay Avatar answered Sep 02 '25 18:09

Michael Kay


It will probably be possible with the <a> tag but make sure you use quote marks

So not like this...

<a href=pagetwo.html>This goes to page two. But does it?</a>

But like this...

<a href="pagetwo.html">It works now! We have quote marks!</a>

Do be very careful because XML is quite strict about quote marks! Here are some of the rules in XML, for reference. Your code won't work if you don't follow them!

  • You need a <!doctype>
  • You need to put tags in lowercase (<tExTaReA> is incorrect)
  • You need to end tags properly
  • You need to close self-closing tags with a /
  • Attribute names need to be in lowercase
  • Attributes need to be in quote marks

source

like image 23
corn on the cob Avatar answered Sep 02 '25 19:09

corn on the cob