Forum Moderators: open

Message Too Old, No Replies

Very simple XML question...

         

JAB Creations

10:24 pm on Mar 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<?xml version="1.0" encoding="iso-8859-1"?>

What is this referred to as? This is not a doctype I know. I'm currently putting together a tutorial and I want it to be very accurate! :-)

kaled

10:22 am on Mar 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



[ucc.ie...]

The link above might be useful to you but <?xml...> it is referred to only as an xml declaration.

Kaled.

choster

11:44 pm on Mar 9, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Another term is XML prologue.

brucec

3:20 am on Mar 10, 2005 (gmt 0)

10+ Year Member



It is a "processing instruction". Any XML line starting with <? is a processing instruction.

Bruce

JAB Creations

7:02 pm on Mar 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, so what would I tell a newb what this is as I'm creating an XHTML tutorial? I'm no XML genius myself :)

Hester

11:29 pm on Mar 10, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you're using XHTML, then it's best to leave the line out altogether. That is if you plan to serve pages to IE6, which has a bug. It drops out of Standards Mode if the XHTML Doctype isn't on the first line. Anyway, the W3C say it is optional, I think.

If you are serving XHTML as pure xhtml/xml, then this is not a problem. (IE6 doesn't support that mode at all.)

As for what the XML line is, well it defines the version of the XML in use (1.0) and the encoding used.

JAB Creations

5:26 am on Mar 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



IE isn't a browser, it's an application that is pretending to be a browser. Once IE becomes a browser I'll care about surrendering to it's W3 abidding will.

The docuement is ultimately XML before it is HTML. Since XHTML is a subset of XML it's importance/ranking is second to XML. Therefore it would be proper to declare the document XML and then XHTML.

I prefer to have the encoding within the XML declartion in contast to having it in say a meta tag.

skinnypuppy

2:55 pm on Mar 11, 2005 (gmt 0)

10+ Year Member



Buried somewhere deep in all of JAB's pedantry is an excellent point.

An XHTML document is exactly one particular flavor of the more general XML document standard.

Car is to Ford as XML is to XHTML (or HTML for that matter).

To go further:

Wheeled travel is to car as SGML is to XML.

But that's another discussion entirely.

brucec

4:54 pm on Mar 11, 2005 (gmt 0)

10+ Year Member



I personally think XHTML is more like HTML. I realize that I may be blasted for saying that.

I realize that XHTML is a sublevel of XML, but the only real similarity that I see between XML and XHTML is that they are both well-formed.

Think about it, people. XHTML is pretty much "well-formed HTML" and it is the W3C's attempt to make HTML well formed.

And I read some of these posts with people saying that XML is a replacement for HTML. At the moment it is not. XHTML is the awaited replacement for HTML. XHTML and HTML have similar DTDs in their namespaces as well.

Bruce

skinnypuppy

5:33 pm on Mar 11, 2005 (gmt 0)

10+ Year Member



Bruce, you're quite wrong.

XHTML is, is, is XML.

Again, Car is to Ford as XML is to XHTML.

So, you could say "No, it's not a car! It's a Ford!"

Sure, but all Fords are cars. It's a car.

To be specific, XHTML is the XML standard which describes how to make XML documents that utilize tags from the HTML standard for formatting of text and media.

Please understand that an XML document can carry arbitrary tags. With this in mind, then an XML document whose tags all happen to be named things like "img", "strong", "li" and so forth is no different from any other.

Except for one thing: pump that bad-boy into a web browser and it dances. It's the browser that's special, or unique, since it knows how to parse XML documents whose tags are found in the HTML tag set, not the XTHML documents themselves.

I feel like I've beaten the dead horse, skinned it, butchered it, and taken it to market as loin steaks. Yet I still wonder if you see this clearly?

brucec

7:22 pm on Mar 11, 2005 (gmt 0)

10+ Year Member



skinpuppy, I read your analogy, but I still disagree with you. I am not sure where you heard or read that XHTML is is is XML.

If you check W3Schools on the XHTML, it says that XHTML is:
XHTML stands for EXtensible HyperText Markup Language
XHTML is aimed to replace HTML
XHTML is almost identical to HTML 4.01
XHTML is a stricter and cleaner version of HTML
XHTML is HTML defined as an XML application

Are you going to argue with W3Schools and tell them that they are wrong? They are the most visited web site for web site technologies. I personally think that your car analogy is irrevelvant.

W3Schools also says that XHTML Is The Official HTML Standard. The same thing is mentioned on the W3C web site and nobody argues with W3C.

So, if you say I am wrong, then you are saying that W3schools and W3C is wrong.

All you have to do is pick up any book on the XHTML and it will say the same thing. I have put together over 100 XML documents for my clients and have taught classes in it.

Let's not argue over this. All you need to do is read any book on XHTML and go to the W3C site and search for XHTML and you will see that your Ford is a car analogy is nowhere to be found on either web site :)

Let's put it this way: XHTML and HTML have almost the same tags with XHTML using the strictness DTD over HTML. With XML you make your own tags and XHTML you do not.

:)

skinnypuppy

7:46 pm on Mar 11, 2005 (gmt 0)

10+ Year Member



"XHTML is HTML defined as an XML application"

Dude, #*$!!?!?

That line of yours that I quoted, that line of yours that you claim refutes my point, that *is exactly* what I've been trying to tell you all along. That is, XHTML (or HTML itself) *is* XML.

What do you think "XHTML is HTML defined as an XML application" means?!?!?

I officially give up.

brucec

8:13 pm on Mar 11, 2005 (gmt 0)

10+ Year Member



skinpuppy, yeah I hear ya. Don't give up. LOL. I think that last line can be taken a lot of ways. It is a little broad.

Personally, I have been using XML as XML and XHTML as HTML. So, I guess different people use it differently. I can see a lot of industry people arguing over this one. I got your point :)

JAB Creations

9:18 pm on Mar 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In XML you can make your own tags.

XHTML is XML and both the W3 and some browsers agree to use those XML tags.

There is another standard besides XML which would be the XHTML subset. This is a secondary standard that W3 and browsers agree that certain XML tags (otherwise known as HTML) can be treated like HTML tags.

I think thats as simple as it can be put.

/////////////////////////////////////////////////////////

In regards to making a site in all XML (not XHTML) would that require setting up our own DTD? How would that work?

brucec

6:26 am on Mar 12, 2005 (gmt 0)

10+ Year Member



JAB Creations, if you want to make a web site all in XML, then you will need an associated XSLT file to make it look like a decent web page. I have done it sucessfully with XSLT.

DTDs are optional. DTD's only serve to make your XML valid, but they will not help your XML documents look like nice looking web pages.

By the way, an XML schema is better than a DTD since schemas are XML as well.

Bruce

Hester

10:40 am on Mar 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can, of course, invent your own doctypes. I know someone who has done this. Here is the real difference between HTML and XHTML. Since XHTML is XML it allows for any tags you wish to invent. But of course, the browser has to interpret them.

Take the Math ML doctype as an example. This extends XHTML to allow for equations and so on to be valid tags. You cannot do this with HTML - it cannot be extended. It has a fixed set of tags.

I do wonder if we should all be writing XML and parsing it to change the tags into HTML. (Eg: <paragraph> => <p>.) That approach would serve me well in the future (allowing for mobiles and other devices) but HTML is always more compact. (<li> instead of <list_item> etc).

At the moment, XHTML is a great way for HTML users to learn about XML.

syber

11:07 pm on Mar 14, 2005 (gmt 0)

10+ Year Member



I hope this clears up a few things. Before there was XML, there was SGML (Standard Generalized Markup Language). HTML 4.0 is a defined markup language using the SGML standard - it has a set of known tags and attributes. SGML is very cumbersome and complicated to work with, so XML was invented as a simplified standard. With the XML standard you can define your own markup language and specify what the allowed tags and attributes are and what order they can appear in. XML is much more strict than SGML - all tags must have closing tags, all attributes must be quoted, lower case is different that upper case, nesting of tags cannot be interlaced, etc.

In an effort to clean up HTML, XHTML was created as a markup language using the new XML specification. So, HTML is to SGML as XHTML is to XML. They are both defined markup impementations of their respective standard.

So to recap, HTML is defined according to the SGML standard and XHTML is defined according to the XML standard.