POV-Ray : Newsgroups : povray.off-topic : The trouble with XSLT : Re: The trouble with XML Server Time
29 Jul 2024 20:22:15 EDT (-0400)
  Re: The trouble with XML  
From: Darren New
Date: 28 Feb 2012 21:47:11
Message: <4f4d91af@news.povray.org>
On 2/27/2012 1:15, Invisible wrote:
> On 26/02/2012 12:35 AM, Darren New wrote:
>> On 2/25/2012 2:37, Orchid Win7 v1 wrote:
>>> For example, to say "this XML file actually contains XHTML", you're
>>> supposed
>>> to add something like 5 separate headers, each about 25 million miles
>>> long,
>>> to the top of the file. Why? Would one header not be sufficient?
>>
>> Really? What do you have to add? I suspect you exaggerate a bit.
>
> First, you must say
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>

You have to do that for XML anyway, so you don't have to do that for "this 
contains XHTML."  Yes, it's more than you need for HTML, but then you don't 
have to rely on a web browser header to tell you what type it is.

> Which is fair enough, although the 5-digit ISO code number isn't exactly
> easy to remember.

I guess if you don't do it often you don't already have such memorized. :-)

> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Right. That's the one line that you need to make it xhtml.

> Yeah, I'm really going to remember that without looking it up. :-P No, you
> can't just say "this is XHTML". You really do have to write all that crap.
> And after /that/, you still have to say
>
> <html xmlns="http://www.w3.org/1999/xhtml">

Er, no, you don't, unless you want an "html" namespace in your XML. If you 
don't want to use anything *except* html in your html document, you don't 
need this line.

> In short, that's a /hell/ of a lot of typing, before I've even written my
> document. It's also a lot of typing that I have to go look up on three
> different websites every single damned time I want to write XHTML.

So, store it somewhere. The first line says it's XML, the second says it's 
XHTML, and the third says how you'll name things if you *don't* use XHTML.

> So why isn't there a DTD somewhere that contains all the entities that
> everybody uses, which I can just link to?

There is. That's what the <!DOCTYPE> tag you complain about is doing. It's 
linking to the entities for xhtml. See that ".dtd" on the end of the URL?

> More to the point, since everybody
> uses the same set of entities, why aren't they built in?

Because they don't. Only the people using XHTML use that set of entities, 
and you complain about having to supply the URL to them. :-)

> You would /think/ you could just say "hey, this stuff here is in the XHTML
> namespace, this stuff here is in the SVG namespace", and that would work.
> But it doesn't. You need to use a DTD specially written for the exact
> combination of XHTML+SVG.

http://www.rpbourret.com/xml/NamespacesFAQ.htm#valid_2

Plus, things like SOAP wouldn't work at all, where you're embedding an 
arbitrary XML inside another arbitrary XML and expecting the processor of 
the latter to be able to understand the former without change.

 > To me, this indicates that the system is
> fundamentally broken. It should not be necessary to write a separate DTD for
> every possible combination of XML documents imaginable. You should just be
> able to refer to the DTD for XHTML and the DTD for SVG and have it work.

http://www.rpbourret.com/xml/NamespacesFAQ.htm#use_5

The basic problem is that you still have to define how the bits combine. Can 
you attach XHTML color declarations to color svg shapes? Can you use svg 
shapes as the shape for bullet points in a bulletted list? If you combined a 
vcard with xhtml, would you be allowed to nest a html:hr element inside the 
street address element of a vcard? Without a DTD that says the allowable 
combinations, there's no way to validate a complete document against a DTD. 
The purpose of the DTD is to ensure that the <hr> element goes inside the 
body and not the head of the HTML document, and that there's only one head 
and one body. How is a generic XML parser supposed to know that you can't 
put an SVG <use> in the header, or a <symbol> between </body> and </html>?

-- 
Darren New, San Diego CA, USA (PST)
   People tell me I am the counter-example.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.