POV-Ray : Newsgroups : povray.off-topic : The trouble with XSLT : Re: The trouble with XML Server Time
29 Jul 2024 16:32:37 EDT (-0400)
  Re: The trouble with XML  
From: Mike Raiford
Date: 9 Mar 2012 15:50:01
Message: <web.4f5a6cccc07fe63964c6b3fb0@news.povray.org>
Invisible <voi### [at] devnull> 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" ?>

Gaah! No! Use UTF-8! 8859-1 is Western European/United States only! Any
characters that are not in this set will be rendered as ? or worse. UTF-8 gives
access to the whole of the Unicode codeset, so no data will be mangled by the
encoding. Sorry, I'm a big proponent of using a more universal character set,
especially when handling data.

>
> Which is fair enough, although the 5-digit ISO code number isn't exactly
> easy to remember. Then you have to say
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>
> 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
>

Yeah, the DTD is a bear; what you do is set up a starting point and use that so
you don't have to remember the DTD all the time.

> <html xmlns="http://www.w3.org/1999/xhtml">
>
> Um, didn't I just declare this as XHTML already? At least this URL is a
> bit shorter, I guess...
>

You set a doctype processing instruction that gives a web browser information on
how to handle your document, remember, HTML comes in many different flavors.
Your xhtml document is an xml document. The xmlns attrubute is specifying that
this document should conform to the specifications of the xhtml standard. I
think this is actually optional, but allows better validation. This uses an xsd
file which defines the schema.

> 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.

Meh. You create a starter file and copy that when you want to do an xhtml file.

> >> Then there's all that stupidity with character entities. It should be
> >> possible to include character entities in /all/ XML documents, not just
> >> XHTML. But to this day, I have never discovered a way of doing this.
> >
> > You have to declare the entities. Otherwise, you run across &frump; and
> > don't know what it means. That's what DTDs are for.
>
> So why isn't there a DTD somewhere that contains all the entities that
> everybody uses, which I can just link to? More to the point, since
> everybody uses the same set of entities, why aren't they built in?
>

Because sgml is a standard that allows a large amount of flexibility in what it
actually is.

> >> One of the nice ideas of XML is that you can use namespaces to include
> >> one
> >> sort of XML document inside enought - e.g., you could put an SVG file
> >> inside
> >> an XHTML file. But nooo, apparently you need a specialised DTD to do
> >> that.
> >
> > You can. Of course, your various processors have to know what the
> > various namespaces *mean*, so you have to declare them and you have to
> > have a processor that understands them (which is where the DTDs come in).
>
> 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. 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.

Thing is, the DTD and schema can be defined anywhere. That's why all of the
clunky URL's.


Post a reply to this message

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