File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes What do tags with semicolons mean? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "What do tags with semicolons mean?" Watch "What do tags with semicolons mean?" New topic

What do tags with semicolons mean?

K Riaz
Ranch Hand

Joined: Jan 08, 2005
Posts: 375
I keep seeing tags with semicolons like the one below and wonder why they exist?

Whats with the "<journal:journal" part?

Also, in another XML document:

Why not " <tspan space="preserve"></tspan>" without the "xml:" bit? How is it like to parse the above elements? Do you need to do anything special, particularly in JDOM?

William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
The part before the colon establishes the "namespace" that the tag belongs to. The start of the XML document establishes the namespaces that are in use and how they will be referrd to.
Here is a short article on handling namespaces.
The fact that you might see a reference to "xml:space" in one document and "space" in another depends on how the document is set up.
For example, I am working with the FOP (formatting objects project) fo tags - mixed with XSL tags. By starting the document:

I don't have to write "fo:block" but can use "block" - the "fo:" is default for the document, but I do have to write all xsl tags with "xsl:"

Just another source of confusion - XML has plenty of them.
I agree. Here's the link:
subject: What do tags with semicolons mean?
jQuery in Action, 3rd edition