 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
The trouble with the whole xml thing is that it's just another
enterprisey BS to grind CPUs idle times. You need an xml document, an
xml document describing the structure of the previous document, yet
another xml document to describe how to style the original document
itens, perhaps a xml document describing how to transform your xml
document into another xml document. It's an insanely verbose and
homogeneous pile of human and machine barely readable crap.
People resented it and thus insist on saner formats, such as CSS, JSON
and real programming languages rather than a shitload of xml abstraction
layers, tools and java frameworks.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 23.02.2012 18:35, schrieb Warp:
> clipka<ano### [at] anonymous org> wrote:
>> As an alternative, forget UTF-8 and go for UTF-16.
>
> UTF-16 is more compact if the text consists mostly of non-ascii
> characters, especially if it contains eg. kanji symbols, hiragana, etc.
> (The vast majority of Japanese kanji can be expressed with 2 bytes using
> UTF-16 but require 3 bytes with UTF-8.)
>
> However, if the text consists mostly of ascii characters, such as
> English usually does, then UTF-8 is more compact than UTF-16 (which will
> basically double the size of the file).
I guess a factor 2 in text stream size is not a serious problem with
today's internet bandwidths.
> Support for UTF-16 is still relatively poor (although getting better).
> Most modern browsers should handle it ok, though, but it requires for the
> server to send the proper http header to tell the browser the encoding,
> and configuring the server to do this might not be trivial. (A html file
> encoded in UTF-16 will look like garbage.)
It didn't sound like Andy would want to retrieve the XML file from a web
server, but rather directly from the local file system. Otherwise he
could simply go for server-side XSLT processing.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 23.02.2012 19:04, schrieb nemesis:
> The trouble with the whole xml thing is that it's just another
> enterprisey BS to grind CPUs idle times. You need an xml document, an
> xml document describing the structure of the previous document, yet
> another xml document to describe how to style the original document
> itens, perhaps a xml document describing how to transform your xml
> document into another xml document. It's an insanely verbose and
> homogeneous pile of human and machine barely readable crap.
>
> People resented it and thus insist on saner formats, such as CSS, JSON
> and real programming languages rather than a shitload of xml abstraction
> layers, tools and java frameworks.
Businesses do use it quite a lot for data exchange.
But yes, XML as a mere replacement for HTML is a rather silly thing
(except in its incarnation as XHTML); its legitimate ecologic niche on
the web is on the server side (if anywhere), and its native habitat is
actually totally somewhere else.
In some sense, XML is today's CSV: A generic file or data stream format
a human /can/ create, read and/or modify with an ASCII text editor, but
that still follows certain clear-cut rules that it can also be evaluated
by software; and actually just a meta-format, in the sense that the
content of the individual data fields needs to be agreed upon separately.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
nemesis <nam### [at] gmail com> wrote:
> The trouble with the whole xml thing is that it's just another
> enterprisey BS to grind CPUs idle times. You need an xml document, an
> xml document describing the structure of the previous document, yet
> another xml document to describe how to style the original document
> itens, perhaps a xml document describing how to transform your xml
> document into another xml document. It's an insanely verbose and
> homogeneous pile of human and machine barely readable crap.
It's verbose, but it has one advantage over most other formats: It's
standardized and pretty well supported.
It has many advantages over many other formats. One example is character
encoding. With all types of character encodings out there, and support
for them in different file formats and programs being what they are, a
*standardized* form for representing special characters can be really
useful. Also, any program that reads XML ought to support it regardless
of which character encoding it uses (at least if the program uses a
generic XML parser internally).
Compare this to, for example, just a simple raw .txt file. Which encoding
does it use? ISO-Latin-1? ISO-Latin-9? UTF-8? Shift JIS? EUC-JP? ISO-2022-JP?
Something else completely? Impossible to say. With an XML file you don't have
to care. (As said, if your program uses a generic XML parser, the character
encoding used in the input XML file becomes a non-issue.)
Not that this exact same thing wouldn't be possible with a less verbose
format, but as said, XML is widely supported so it has this implicit
advantages over many other formats.
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Le 23/02/2012 20:06, Warp nous fit lire :
> It's verbose, but it has one advantage over most other formats: It's
> standardized and pretty well supported.
>
Well, XML is a container. The problem is lack of intelligent design for
the inside. It is too often the Excel sheet of today: A bunch of
entries, without consistency.
Indeed, with a bit of base64 encapsulation, you could put an BINARY
excel sheet file into a XML document. And advertise that you output XML.
And to make matter more interesting, some find it enterprisey to have
xml inside xml... and other old CSV into XML too (without reinterpreting
the data, so it's just a formatting. A dumb formatting).
> It has many advantages over many other formats. One example is character
> encoding. With all types of character encodings out there, and support
> for them in different file formats and programs being what they are, a
> *standardized* form for representing special characters can be really
> useful. Also, any program that reads XML ought to support it regardless
> of which character encoding it uses (at least if the program uses a
> generic XML parser internally).
Read it, yes. Understand it, that's another whole story!
Same as: I can read latin or japanese in katakana, with few error on
sound. That does not means I get the meaning. At least I can edit it
like a monkey.
> Not that this exact same thing wouldn't be possible with a less verbose
> format, but as said, XML is widely supported so it has this implicit
> advantages over many other formats.
XML is interesting when exchanging documents/data, once the big bosses
and their technical staffs have agreed on a XSD. But whenever you add a
third company, you need to negociate another XSD (with a totally
different approach of the data, not even compatible with the first one).
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 23/02/2012 17:35, Warp wrote:
> Support for UTF-16 is still relatively poor (although getting better).
> Most modern browsers should handle it ok, though, but it requires for the
> server to send the proper http header to tell the browser the encoding,
> and configuring the server to do this might not be trivial. (A html file
> encoded in UTF-16 will look like garbage.)
Isn't that what the HTML encoding tag is for? Or the XML encoding
declaration?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 23.02.2012 22:14, schrieb Orchid Win7 v1:
> On 23/02/2012 17:35, Warp wrote:
>> Support for UTF-16 is still relatively poor (although getting better).
>> Most modern browsers should handle it ok, though, but it requires for the
>> server to send the proper http header to tell the browser the encoding,
>> and configuring the server to do this might not be trivial. (A html file
>> encoded in UTF-16 will look like garbage.)
>
> Isn't that what the HTML encoding tag is for? Or the XML encoding
> declaration?
You can't read those until you know at least some basics about the
encoding :-P
That's /one/ reason why XML requires UTF-16 files to start with a byte
order mark: If the file starts with "FE FF" or "FF FE", it's either
UTF-16, malformed XML (not starting with optional whitespace followed by
"<?"), or indeed garbish, so UTF-16 is a safe bet in that case.
Otherwise rely on the file format being backward compatible with ASCII,
and treat it as UTF-8 (which is ASCII-compatible as well) until an
encoding declaration tells you otherwise.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2/23/2012 11:06, Warp wrote:
> It's verbose, but it has one advantage over most other formats: It's
> standardized and pretty well supported.
It also has an advantage in that it's a *markup language*. That's what it's
for. Just as it sucks for passing around arrays of floats or passing pov-ray
data objects between clusters of renderers or encoding routing table
updates, it does pretty darn good at things like writing help pages, user
manuals, and so on.
Bitching that XML is poorly suited for something it was never designed to do
is just pointless.
It's only verbose if you're not using it to pass around human-readable prose.
--
Darren New, San Diego CA, USA (PST)
People tell me I am the counter-example.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> Isn't that what the HTML encoding tag is for? Or the XML encoding
>> declaration?
>
> You can't read those until you know at least some basics about the
> encoding :-P
Yeah. Isn't that fun? :-D
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 23/02/2012 07:06 PM, Warp wrote:
> It's verbose, but it has one advantage over most other formats: It's
> standardized and pretty well supported.
Well, it was that or JSON.
In my case, XML has XSLT. JSON does not possess anything comparable.
What that means is that just by outputting my data as XML, I can easily
transform it into something usable later. And I don't have to implement
the transformation engine myself - just the actual transformation rules.
(Which is still pretty non-trivial, mind you.)
(The other possibility is the unspeakably awful YAML...)
Some people /do/ use XML in some pretty inappropriate ways. (E.g., "if
we store all our data as XML, we won't have to ask the DB admin to
change the DB schema for us, and we can just run all the queries on the
client-side instead".) Just because people do stupid things with XML,
does not mean that XML is stupid.
That said, it /does/ seem overly complicated for the simple problem it's
supposed to solve...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
clipka <ano### [at] anonymous org> wrote:
> That's /one/ reason why XML requires UTF-16 files to start with a byte
> order mark: If the file starts with "FE FF" or "FF FE", it's either
> UTF-16, malformed XML (not starting with optional whitespace followed by
> "<?"), or indeed garbish, so UTF-16 is a safe bet in that case.
> Otherwise rely on the file format being backward compatible with ASCII,
> and treat it as UTF-8 (which is ASCII-compatible as well) until an
> encoding declaration tells you otherwise.
OTOH, it would be quite trivial to guess that a HTML/XML file is
UTF-16-encoded: If each other byte is 0 and each other form valid
HTML/XML (at least up to the header section that specifies the encoding),
then it's a safe bet that it's UTF16-encoded.
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Darren New escreveu:
> On 2/23/2012 11:06, Warp wrote:
>> It's verbose, but it has one advantage over most other formats: It's
>> standardized and pretty well supported.
>
> It also has an advantage in that it's a *markup language*. That's what
> it's for. Just as it sucks for passing around arrays of floats or
> passing pov-ray data objects between clusters of renderers or encoding
> routing table updates, it does pretty darn good at things like writing
> help pages, user manuals, and so on.
>
> Bitching that XML is poorly suited for something it was never designed
> to do is just pointless.
Precisely so, like implementing validators or transformers for xml docs.
How recursive and verbose you can get? "Hey, Darren, have you already
wrote that xml document to validate the xml document validator that
validates our client xml document?"
I can't actually believe a typeful haskell supporter (I'm looking at
Orchid) is here advocating an xml document rather than writing a typeful
haskell program to validate data marshalling.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2/24/2012 1:10, Invisible wrote:
> That said, it /does/ seem overly complicated for the simple problem it's
> supposed to solve...
What simple problem do you think it was supposed to solve?
--
Darren New, San Diego CA, USA (PST)
People tell me I am the counter-example.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 25/02/2012 06:04, Darren New wrote:
> On 2/24/2012 1:10, Invisible wrote:
>> That said, it /does/ seem overly complicated for the simple problem it's
>> supposed to solve...
>
> What simple problem do you think it was supposed to solve?
The problem of marking up textual data.
A lot of people seem to think that if you just write some stuff in angle
brackets, that's XML. But it' actually far more complicated than that.
(As an aside, those aren't angle brackets. They're inequality signs. :-P
But I digress...)
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?
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.
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. In fact, you need one DTD for XHTML + SVG, another,
different DTD for XHTML + MathML, a third, different DTD for XHTML +
MathML + SVG, and... ARE YOU PEOPLE INSANE?!
In short, most people just end up sticking stuff in angle brackets and
calling that XML. /Actual/ XML is far too complicated.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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.
> 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.
> 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).
--
Darren New, San Diego CA, USA (PST)
People tell me I am the counter-example.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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" ?>
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
<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...
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.
>> 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?
>> 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.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>>> 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."
Well, that at least is true enough.
>> 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. :-)
I don't generally make a habit of memorising long code numbers, no.
>> <!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.
Well, it's more like 3 lines. :-P
>> 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.
The W3C validator disagrees.
The above declaration sets the default namespace for any elements which
do not have a namespace explicitly declared. W3C seems to insist that
this is /required/, even though a doctype has already been given.
(For example, my personal web pages do not have this third declaration.
When I wrote them, the validator accepted them. Today, it rejects them
because of the missing third declaration. Gotta love how a set of
standards compliant pages are no longer compliant with the same
standard, even though the pages haven't changed...)
>> 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.
That's what I end up doing. And then every time I go to a different
computer, I have to look it up all over again.
>> 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?
It's linking the entire definition of the XHTML language, not just the
character entities.
As far as I know, there is no way of using XHTML entities without also
declaring that this is an XHTML document. If just the entity definitions
were in a separate DTD, you could maybe do it. (But even then, I have a
sinking feeling you can only have one DTD per document, so you'd still
be stuffed.)
>> 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. :-)
Well, 3 URLs. :-P
>> 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
I'm not sure what this is trying to say.
I know that you /can/ stuff more than one namespace into an XML
document. It's just that it doesn't /work/ when you try to use it.
> 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.
Didn't we just...? Oh wait, that's SOPA. Never mind.
>> 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
I still don't follow.
> 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.
Isn't that the purpose of the HTML <object> tag though? So it can
contain an arbitrary object? If you just state that <object> is the only
place where elements from another namespace can go, the problem is solved.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 2/29/2012 1:24, Invisible wrote:
> The W3C validator disagrees.
Their validator might not be compliant with the standard.
> (For example, my personal web pages do not have this third declaration. When
> I wrote them, the validator accepted them. Today, it rejects them because of
> the missing third declaration. Gotta love how a set of standards compliant
> pages are no longer compliant with the same standard, even though the pages
> haven't changed...)
See? Either it wasn't before, or it isn't now. Hard to say without actually
delving deep into the mess.
>> 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?
>
> It's linking the entire definition of the XHTML language, not just the
> character entities.
Right. Well, what do you expect?
> As far as I know, there is no way of using XHTML entities without also
> declaring that this is an XHTML document.
Right. Because that would be meaningless.
> If just the entity definitions
> were in a separate DTD, you could maybe do it. (But even then, I have a
> sinking feeling you can only have one DTD per document, so you'd still be
> stuffed.)
Correct and correct, and it makes perfect sense why this is so.
>> http://www.rpbourret.com/xml/NamespacesFAQ.htm#valid_2
>
> I'm not sure what this is trying to say.
It's explaining why it doesn't make sense to ask to have more than one DTD
for a document. An XML document forms a tree. A DTD describes which types of
nodes can be descendants of other types of nodes. It wouldn't make sense to
have two of those declarations for one tree.
It's like complaining in Haskell that if you want to use either an integer
or a string in a variable, you have to declare a type that supports a choice
between *both*, instead of just mixing them together.
If you don't check structure with a DTD, you can mix and match whatever you
want. But a DTD is the "strong typing" for XML (and SGML), and it doesn't
make sense to say "here's a set of two independant declarations of types."
> I know that you /can/ stuff more than one namespace into an XML document.
> It's just that it doesn't /work/ when you try to use it.
It ... works for me. You just have to (a) do it right and (b) have a tool
that supports it.
> Isn't that the purpose of the HTML <object> tag though? So it can contain an
> arbitrary object? If you just state that <object> is the only place where
> elements from another namespace can go, the problem is solved.
1) Can HTML appear inside the <object> tag? If so, can your other namespace
also appear inside the <object> tag inside the <html> tag inside the
<object> tag? Etc.
2) Sure, for HTML. Solve that in a general way. What if you want only some
tags to appear in the <head> and only other tags appear in the <body>? No,
there's no notation in a DTD that says "by the way, don't check the validity
of anything inside this particular type of tag." Other than CDATA maybe.
--
Darren New, San Diego CA, USA (PST)
People tell me I am the counter-example.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 02/03/2012 05:54 AM, Darren New wrote:
> On 2/29/2012 1:24, Invisible wrote:
>> The W3C validator disagrees.
>
> Their validator might not be compliant with the standard.
That sounds /highly/ implausible...
> See? Either it wasn't before, or it isn't now. Hard to say without
> actually delving deep into the mess.
I'm going to suggest that they changed the standard to be more
restrictive, or they added a missing check to the validator. It seems
unlikely that the validator would become /less/ compliant over time. But
sure, "mess" seems like an accurate way to describe it. :-P
>> It's linking the entire definition of the XHTML language, not just the
>> character entities.
>
> Right. Well, what do you expect?
>
>> As far as I know, there is no way of using XHTML entities without also
>> declaring that this is an XHTML document.
>
> Right. Because that would be meaningless.
The point is, any XML document that contains text may potentially need
non-ASCII characters. But only XML documents which are also XHTML can
contain non-ASCII characters. How is that sensible?
Sure, having more than one DTD doesn't make a lot of sense. (Except that
it would be nice to apply different DTDs to different namespaces. But
that has little to do with entities.) The problem is that character
entities are in the DTD, not defined in the XML spec for /everyone/ to use.
>>> http://www.rpbourret.com/xml/NamespacesFAQ.htm#valid_2
>>
>> I'm not sure what this is trying to say.
>
> It's explaining why it doesn't make sense to ask to have more than one
> DTD for a document. An XML document forms a tree. A DTD describes which
> types of nodes can be descendants of other types of nodes. It wouldn't
> make sense to have two of those declarations for one tree.
OK. But it could make sense for different DTDs to apply to different
subtrees, surely?
>> I know that you /can/ stuff more than one namespace into an XML document.
>> It's just that it doesn't /work/ when you try to use it.
>
> It ... works for me. You just have to (a) do it right and (b) have a
> tool that supports it.
Write at XHTML document which contains some MathML. Unless you use the
magic XHTML+MathML DTD, it doesn't work at all. Clearly it /should/, but
it doesn't.
>> Isn't that the purpose of the HTML <object> tag though? So it can
>> contain an
>> arbitrary object? If you just state that <object> is the only place where
>> elements from another namespace can go, the problem is solved.
>
> 1) Can HTML appear inside the <object> tag? If so, can your other
> namespace also appear inside the <object> tag inside the <html> tag
> inside the <object> tag? Etc.
>
> 2) Sure, for HTML. Solve that in a general way. What if you want only
> some tags to appear in the <head> and only other tags appear in the
> <body>? No, there's no notation in a DTD that says "by the way, don't
> check the validity of anything inside this particular type of tag."
> Other than CDATA maybe.
In summary, XML doesn't provide the necessary tools to solve common
problems such as mixing more than one markup together.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Le 2012-03-02 04:25, Invisible a écrit :
> On 02/03/2012 05:54 AM, Darren New wrote:
>> On 2/29/2012 1:24, Invisible wrote:
>>> As far as I know, there is no way of using XHTML entities without also
>>> declaring that this is an XHTML document.
>>
>> Right. Because that would be meaningless.
>
> The point is, any XML document that contains text may potentially need
> non-ASCII characters. But only XML documents which are also XHTML can
> contain non-ASCII characters. How is that sensible?
Non-XHTML documents can and do contain non-ASCII characters. What you
meant to say is that you can't use their XHTML representations outside
an XHTML document. Case in point: a .DOCX file does not use é or
à but can most definitely contain the characters represented by
those entities.
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* gmail.com */}camera{orthographic location<6,1.25,-6>look_at a }
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 3/2/2012 1:25, Invisible wrote:
> The point is, any XML document that contains text may potentially need
> non-ASCII characters. But only XML documents which are also XHTML can
> contain non-ASCII characters. How is that sensible?
No. Only XML documents which are also XHTML documents can use the XHTML
standard for specifying ASCII-only names for non-ASCII characters.
You *can* put non-ASCII characters in an XML document. That's what the first
line is for, with the hard-to-remember code numbers, remember? Different
standards can have different entities. If I want an XML entity that
represents the symbol for the left eyeball, or an XML entity that represents
a internal link to the document management system of google, I can do that
-- just not in XHTML. Look at the triglyphs for C-on-punched-cards. Same
sort of thing. They're only applicable to C.
> Sure, having more than one DTD doesn't make a lot of sense. (Except that it
> would be nice to apply different DTDs to different namespaces. But that has
> little to do with entities.) The problem is that character entities are in
> the DTD, not defined in the XML spec for /everyone/ to use.
So type the characters directly. Nothing stops you from embedding a thron or
an omega in your document except that you don't want to learn how to type
one on the keyboard you have.
> OK. But it could make sense for different DTDs to apply to different
> subtrees, surely?
You still have to have one DTD that says where the trees are allowed to join
up. There's nothing that says that DTD isn't trivial to construct from two
other DTDs.
>>> I know that you /can/ stuff more than one namespace into an XML document.
>>> It's just that it doesn't /work/ when you try to use it.
>>
>> It ... works for me. You just have to (a) do it right and (b) have a
>> tool that supports it.
>
> Write at XHTML document which contains some MathML. Unless you use the magic
> XHTML+MathML DTD, it doesn't work at all. Clearly it /should/, but it doesn't.
Sure. You have to have the right DTD, because MathML expressions can't
appear inside URLs, nor can they appear as a child of a <meta> link in the
header, etc. You have to know the rules of where each can appear in the
other if you want to actually check it's right.
> In summary, XML doesn't provide the necessary tools to solve common problems
> such as mixing more than one markup together.
It does. You just don't like the solution. It's like you're saying "Haskell
doesn't provide the necessary tools to incorporate C syntax into its type
declarations." No, they're completely different type systems.
--
Darren New, San Diego CA, USA (PST)
People tell me I am the counter-example.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> The point is, any XML document that contains text may potentially need
>> non-ASCII characters. But only XML documents which are also XHTML can
>> contain non-ASCII characters. How is that sensible?
>
> No. Only XML documents which are also XHTML documents can use the XHTML
> standard for specifying ASCII-only names for non-ASCII characters.
Why would you want three different standard names for the same character?
> So type the characters directly. Nothing stops you from embedding a
> thron or an omega in your document except that you don't want to learn
> how to type one on the keyboard you have.
Well, for that matter, you can just type the Unicode code number
directly. (This at least works with all operating systems and text
editors, doesn't break every five minutes, etc.) It's just that
memorising large quantities of code numbers isn't exactly trivial.
>> OK. But it could make sense for different DTDs to apply to different
>> subtrees, surely?
>
> You still have to have one DTD that says where the trees are allowed to
> join up. There's nothing that says that DTD isn't trivial to construct
> from two other DTDs.
Well, if it were possible for one DTD to import several others, then it
could be pretty easy... As it is, constructing even one DTD is so
insanely hard that only the professionals can do it.
>> In summary, XML doesn't provide the necessary tools to solve common
>> problems
>> such as mixing more than one markup together.
>
> It does. You just don't like the solution.
What, a combinatorial explosion of DTDs for every possible combination
of XML applications that you might ever want to combine? No, that's just
silly.
> It's like you're saying
> "Haskell doesn't provide the necessary tools to incorporate C syntax
> into its type declarations." No, they're completely different type systems.
Not relevant, but: Actually Haskell does let you do this. There's a
standard preprocessor for exactly this task. People use it when binding
to external C or C++ libraries.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 3/3/2012 1:29, Orchid Win7 v1 wrote:
> Why would you want three different standard names for the same character?
What's the chinese word for "quotation mark"? For that matter, why would you
even want a "name" for a character, unless your text editor is too lame to
actually store the character? Leap-frog into the 21st century and start
using Windows Notepad to edit your text or something.
> Well, for that matter, you can just type the Unicode code number directly.
> (This at least works with all operating systems and text editors, doesn't
> break every five minutes, etc.) It's just that memorising large quantities
> of code numbers isn't exactly trivial.
Right. So you're complaining that XML is broken because your text editor
can't handle Unicode? Just type the unicode characters directly into the
text document, without using any code numbers.
> Well, if it were possible for one DTD to import several others, then it
> could be pretty easy... As it is, constructing even one DTD is so insanely
> hard that only the professionals can do it.
... says the man who programs in Haskell. ;-)
You don't really have to *import* DTDs. You can pretty much just concatenate
them, as long as there aren't conflicting definitions, and fix up only the
places where they actually interact. I mean, if you have some java-specific
XML (say, a build system), and you want to embed SVG into that (say, to
define the splash screen for the completed program), your build system is
going to have to understand how to interpret SVG.
> What, a combinatorial explosion of DTDs for every possible combination of
> XML applications that you might ever want to combine? No, that's just silly.
Why not? You get a combinatorial explosion of types in your computer
programs for every new program you write.
Generally, your XML processor has to understand the combination you're using
anyway, so it's not really obvious there's a problem here. It's not like
you're going to combine SEP and XHTML in one program and expect to not do
more work than frobbing around the DTD.
--
Darren New, San Diego CA, USA (PST)
People tell me I am the counter-example.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> Why would you want three different standard names for the same character?
>
> What's the chinese word for "quotation mark"? For that matter, why would
> you even want a "name" for a character, unless your text editor is too
> lame to actually store the character? Leap-frog into the 21st century
> and start using Windows Notepad to edit your text or something.
It's not possible to type exotic characters. But it's trivial to type in
their names.
> Right. So you're complaining that XML is broken because your text editor
> can't handle Unicode? Just type the unicode characters directly into the
> text document, without using any code numbers.
...aaaand then watch it break into a thousand pieces because raw text
files have no way of specifying what actual character encoding is being
used. :-P
>> Well, if it were possible for one DTD to import several others, then it
>> could be pretty easy... As it is, constructing even one DTD is so
>> insanely hard that only the professionals can do it.
>
> ... says the man who programs in Haskell. ;-)
The problem is, the only real documentation on how to write DTDs is the
antiquated SGML reference documentation, which is hardly easy going.
From what I've seen from other written DTDs, it's just damned hard,
that's all.
>> What, a combinatorial explosion of DTDs for every possible combination of
>> XML applications that you might ever want to combine? No, that's just
>> silly.
>
> Why not? You get a combinatorial explosion of types in your computer
> programs for every new program you write.
Actually... no, you don't.
In any half-decent language, you can implement sorting and searching.
Once. In a language that's not so good, you have to reimplement this for
every individual datatype. And that's what the DTD situation feels like;
endlessly reimplementing the same language specs over and over again.
And these aren't exactly trivial languages... It would be frighteningly
easy to come up with an XHTML+MathML DTD where the XHTML part doesn't
actually match the stand-alone XHTML DTD, for example.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 3/3/2012 14:04, Orchid Win7 v1 wrote:
> It's not possible to type exotic characters.
Sure it is. I just turned on chinese for my wife. Use alt-shift to toggle
between languages. :-)
The problem is that your *editor* doesn't make it simple to type exotic
characters, yes? Why do you complain that your XML processor doesn't
understand exotic characters when its your editor that makes them difficult
to type?
> ...aaaand then watch it break into a thousand pieces because raw text files
> have no way of specifying what actual character encoding is being used. :-P
That's why the first line of your XML document includes the character set in
which the rest of the document is written. *right there* is the reason you
have to put <?xml ...> at the start, along with the funky code number for
your character set.
> The problem is, the only real documentation on how to write DTDs is the
> antiquated SGML reference documentation, which is hardly easy going. From
> what I've seen from other written DTDs, it's just damned hard, that's all.
It's actually pretty straightforward. Google "dtd tutorial".
> It would be frighteningly easy to come up with
> an XHTML+MathML DTD where the XHTML part doesn't actually match the
> stand-alone XHTML DTD, for example.
Sure. And it would be frighteningly easy to come up with a generic sorting
algorithm that works incorrectly on certain types. Don't do that.
The point is that a DTD is a type specification. It also originally
specified what closing tags could be left out by specifying what could be
nested inside what. (You don't have to close a paragraph in a book if the
next tag opens a new chapter, because chapters don't nest and paragraphs
can't contain chapters.)
So don't use a DTD. Use an XSL or whatever they call it these days.
--
Darren New, San Diego CA, USA (PST)
People tell me I am the counter-example.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 04/03/2012 00:08, Darren New wrote:
> On 3/3/2012 14:04, Orchid Win7 v1 wrote:
>> It's not possible to type exotic characters.
>
> Sure it is. I just turned on chinese for my wife. Use alt-shift to
> toggle between languages. :-)
That doesn't make the characters available on your keyboard though. It's
not like you can just press a button and have a different set of
characters printed on your physical keyboard.
> The problem is that your *editor* doesn't make it simple to type exotic
> characters, yes? Why do you complain that your XML processor doesn't
> understand exotic characters when its your editor that makes them
> difficult to type?
It's not the editor that makes them hard to type. It's the fact that
computer keyboards only have a few hundred keys, not several billion
keys. (Heck, even then it would be pretty difficult to actually /find/
the one you want...)
In most situations, that just means that you flat-out /can't/ use
unusual characters. HTML, and now XHTML, are fairly unusual in that they
let you type in the character's name if you can't easily type the
character itself. Unfortunately, rather than make this useful feature
available to all XML applications, they arbitrarily chose to make it
available to only one.
>> ...aaaand then watch it break into a thousand pieces because raw text
>> files
>> have no way of specifying what actual character encoding is being
>> used. :-P
>
> That's why the first line of your XML document includes the character
> set in which the rest of the document is written. *right there* is the
> reason you have to put <?xml ...> at the start, along with the funky
> code number for your character set.
That tells an XML processor what the character encoding is. It does not
tell your text editor what the encoding is.
>> It would be frighteningly easy to come up with
>> an XHTML+MathML DTD where the XHTML part doesn't actually match the
>> stand-alone XHTML DTD, for example.
>
> Sure. And it would be frighteningly easy to come up with a generic
> sorting algorithm that works incorrectly on certain types. Don't do that.
The point is, to make a DTD for a combination of trees, you have to
/copy/ the DTDs for each subtree - and hope that you don't do it wrong.
Talk above violating the DRY printiple...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 3/4/2012 9:07, Orchid Win7 v1 wrote:
> That doesn't make the characters available on your keyboard though. It's not
> like you can just press a button and have a different set of characters
> printed on your physical keyboard.
Actually, you can, yes. http://www.lcd-keys.com/english/history.htm
:-)
> It's not the editor that makes them hard to type. It's the fact that
> computer keyboards only have a few hundred keys, not several billion keys.
And yet, oddly enough, billions of chinese people seem to get along OK.
It's still the case that you're addressing the wrong technology. The file
itself has no trouble storing the characters, yet you want the file storage
technology to compensate for your computer's inability to put the characters
into the file conveniently.
Fix your input mechanism, and store the characters. Don't fix every program
that reads characters to deal with names. Fix your *editor* to deal with
names. Make it so when you type &acut; into your editor, it replaces it with
the right unicode character. Problem solved.
> type in the character's name if you can't easily type the character itself.
Why doesn't your editor do this?
> Unfortunately, rather than make this useful feature available to all XML
> applications, they arbitrarily chose to make it available to only one.
Because different XML applications need different character entities.
> That tells an XML processor what the character encoding is. It does not tell
> your text editor what the encoding is.
So always use UTF-8 or something. Or write your editor to recognize an XML
header and parse it.
> The point is, to make a DTD for a combination of trees, you have to /copy/
> the DTDs for each subtree - and hope that you don't do it wrong. Talk above
> violating the DRY printiple...
But to *use* a DTD for a combination of trees, you have to implement an
entire program to do so. So the actual concatenation of two files is rather
simple, comparatively speaking.
--
Darren New, San Diego CA, USA (PST)
People tell me I am the counter-example.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 04.03.2012 18:07, schrieb Orchid Win7 v1:
> On 04/03/2012 00:08, Darren New wrote:
>> On 3/3/2012 14:04, Orchid Win7 v1 wrote:
>>> It's not possible to type exotic characters.
>>
>> Sure it is. I just turned on chinese for my wife. Use alt-shift to
>> toggle between languages. :-)
>
> That doesn't make the characters available on your keyboard though. It's
> not like you can just press a button and have a different set of
> characters printed on your physical keyboard.
That /may/ depend on your keyboard...
http://www.artlebedev.com/everything/optimus/maximus/
> In most situations, that just means that you flat-out /can't/ use
> unusual characters. HTML, and now XHTML, are fairly unusual in that they
> let you type in the character's name if you can't easily type the
> character itself. Unfortunately, rather than make this useful feature
> available to all XML applications, they arbitrarily chose to make it
> available to only one.
Did anyone already mention that they did /not/ "arbitrarily" choose "to
make it available to only one", but rather /deliberately/ chose to make
it availabe to /this/ one (despite the general decision to keep the XML
set of character entities simple), because "we'll never get people to
convert from HTML if they can't do this in XHTML"?
>
>>> ...aaaand then watch it break into a thousand pieces because raw text
>>> files
>>> have no way of specifying what actual character encoding is being
>>> used. :-P
>>
>> That's why the first line of your XML document includes the character
>> set in which the rest of the document is written. *right there* is the
>> reason you have to put <?xml ...> at the start, along with the funky
>> code number for your character set.
>
> That tells an XML processor what the character encoding is. It does not
> tell your text editor what the encoding is.
How about rephrasing this: "It does not /necessarily/ tell your text
editor what the encoding is."
What part of "get a decent text editor" didn't you understand? :-P
> The point is, to make a DTD for a combination of trees, you have to
> /copy/ the DTDs for each subtree - and hope that you don't do it wrong.
> Talk above violating the DRY printiple...
... which is why there is XML Schema. And XML namespaces.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> That tells an XML processor what the character encoding is. It does not
>> tell your text editor what the encoding is.
>
> How about rephrasing this: "It does not /necessarily/ tell your text
> editor what the encoding is."
>
> What part of "get a decent text editor" didn't you understand? :-P
Can you name one single text editor which can actually change character
encoding based on a mere XML encoding specification?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Le 2012-03-05 03:54, Invisible a écrit :
>>> That tells an XML processor what the character encoding is. It does not
>>> tell your text editor what the encoding is.
>>
>> How about rephrasing this: "It does not /necessarily/ tell your text
>> editor what the encoding is."
>>
>> What part of "get a decent text editor" didn't you understand? :-P
>
> Can you name one single text editor which can actually change character
> encoding based on a mere XML encoding specification?
I would bet emacs does it, since it does everything, including sorting
laundry and fixing tires.
But seriously, though, http://www.lmgtfy.com/?q=xml+editors
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* gmail.com */}camera{orthographic location<6,1.25,-6>look_at a }
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>>> What part of "get a decent text editor" didn't you understand? :-P
>>
>> Can you name one single text editor which can actually change character
>> encoding based on a mere XML encoding specification?
>
> I would bet emacs does it, since it does everything, including sorting
> laundry and fixing tires.
Yeah. But then I'd have to use Emacs...
> But seriously, though, http://www.lmgtfy.com/?q=xml+editors
Right. Because my text editor only needs to edit XML. Oh, wait...
In all seriousness though. I could probably just configure my editor to
always use UTF-8. That still doesn't solve the problem of typing obscure
characters in the first place. And it still doesn't change the fact that
as soon as I open the file in any other program, it's going to break
because that other program doesn't know what the hell character encoding
to use.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 05.03.2012 09:54, schrieb Invisible:
>>> That tells an XML processor what the character encoding is. It does not
>>> tell your text editor what the encoding is.
>>
>> How about rephrasing this: "It does not /necessarily/ tell your text
>> editor what the encoding is."
>>
>> What part of "get a decent text editor" didn't you understand? :-P
>
> Can you name one single text editor which can actually change character
> encoding based on a mere XML encoding specification?
The integrated text editors of both MS Visual Studio 2010 and
BeyondCompare 3.0 definitely do it (and yes, I'm talking about plain
"ASCII" text editors, not dedicated XML editor components).
As for stand-alone text editors, I've not used any for years, but I
wouldn't be surprised if current versions of e.g. UltraEdit would be
doing this as well (it does have some "auto-detect UTF-8 encoding"
option after all, though I can't find any details about the magic used
in there).
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Am 05.03.2012 19:19, schrieb Orchid Win7 v1:
>>>> What part of "get a decent text editor" didn't you understand? :-P
> In all seriousness though. I could probably just configure my editor to
> always use UTF-8. That still doesn't solve the problem of typing obscure
> characters in the first place.
Did you know that good text editors allow you to define your own fancy
keystroke combinations? So you can place your favorite special
characters on some easily memorizable combo of Alt-Shift-Explode or
whatever suits your needs.
> And it still doesn't change the fact that
> as soon as I open the file in any other program, it's going to break
> because that other program doesn't know what the hell character encoding
> to use.
That's plain stupid nonsense. A non-UTF-8-aware text editor (or any
other piece of software capable of processing extended-ASCII text files)
confronted with a UTF-8 text file will display apparently random stuff
in place of any non-ASCII characters, but that random stuff saves fine,
and parses back as later UTF-8 without problem. Just make sure you don't
insert non-ASCII characters in the troublesome editor, and don't insert
anything into that random stuff.
This property is one of the fun things about UTF-8: Anything that can
handle at least /one/ extended-ASCII codepage can also handle UTF-8
transparently without even knowing.
(You /will/ get into trouble though if your <?xml ...?> declaration
doesn't match the actual character encoding of the file, but I guess
that should be obvious.)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Mon, 05 Mar 2012 20:10:56 +0100, clipka wrote:
> Alt-Shift-Explode
I need a keyboard that has that as an option on it. :)
Jim
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 3/4/2012 18:05, clipka wrote:
> ... which is why there is XML Schema. And XML namespaces.
Actually, I'd be happy if once, once in my career, someone would provide me
"an XML feed" that could actually be parsed by an XML library without first
having to do a bunch of string crap to it to make it right.
--
Darren New, San Diego CA, USA (PST)
People tell me I am the counter-example.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 3/5/2012 0:54, Invisible wrote:
> Can you name one single text editor which can actually change character
> encoding based on a mere XML encoding specification?
I expect you could set up vim to do it, since you can set it up to recognize
Python, Bash, etc.
--
Darren New, San Diego CA, USA (PST)
People tell me I am the counter-example.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible <voi### [at] dev null> 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
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Le_Forgeron <lef### [at] free fr> wrote:
> Le 23/02/2012 10:11, Invisible a écrit :
> > This still leaves me with the problem of how to generate unusual
> > characters in the first place. Typing → is pretty simple. Figuring
> > out how to actually generate the arrow character is not.
>
> You just need the right documentation.
> Either you search it each time on the web (like "utf-8 chartable"... )
>
> or you call it correctly, and ask for unicode (utf-8 is one
> presentation, unicode is what you really want), and get to print the
> parts that you need often.
>
> See http://unicode.org/charts/
>
> And soon you will discover that there is no single font to display all
> possible unicode glyphs.
>
> You also need a unicode-compatible editor...
Code2000 comes close for Plane 1... The higher planes are a different story
alltogether, but most of those are rather specialized anyway.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mike Raiford <no.### [at] spam me> wrote:
> > <?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.
Nothing stops you from using &#xx; codes regardless of the encoding.
--
- Warp
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Invisible <voi### [at] dev null> wrote:
> OK, so I've written a program that generates a bunch of XML as output.
> If you open that in a web browser, it shows up as a simple parse tree.
> Which is OK, but a little verbose.
>
> Fortunately, using the wonders of XSL (specifically, XSLT) you can have
> the browser transform the raw XML into a pretty-looking XHTML document.
>
> But *only* if you edit the original XML file to mention the XSLT file
> that you want to apply.
>
> Now, it ought to be simple to write a 3-line file that says "take this
> XML file and that XSLT file, and display the result". But after over a
> week searching the Internet and even consulting Stack Overflow, I cannot
> find any way of doing this. I literally cannot *believe* that something
> so trivially simple is also so utterly impossible.
>
> If there /is/ a way of doing this, every single XSL tutorial in
> Christendom fails to mention it. No XSL FAQs mention it either - it's
> not even that they say it can't be done, it's that none of them even
> contain a question about this topic. This raises the alarming
> possibility that what I'm trying to do might actually be impossible
> after all. (Which is slightly daft, given that it's the entire point of
> XSL existing in the first place...)
>
> To be clear: It seems to be perfectly possible to apply any XSL to any
> XML if you use an external 3rd-party tool. You just can't do it with a
> *web browser*. You know, those programs that know about XML and XSL and
> are installed on every computer in the world. No, you have to select and
> download a special CLI utility if you want to perform such advanced
> wizardry. *sigh*
>
> My first thought: XSL lets you include one stylesheet inside another, so
> maybe you can include one source document inside... erm, no. No you can't.
>
> It looks like it /might/ be plausible to do something with the XSL
> document() function - but I haven't figured out exactly how yet.
>
> Apparently XML itself has a general include feature called XInclude.
> According to Wikipedia, "Browser support: None". *facepalm* OK, so
> that's really going to help then.
>
> About the closest thing I've found is a website that says that if you
> copy and paste a few miles of convoluted JavaScript code, you can make a
> web page that runs the script which then loads the required XML in the
> background, lots the XSL, applies one to the other, and inserts the
> result into a specific position in the DOM of the current document. In
> particular, it cannot /replace/ the current document, it can only be
> /inserted into/ it. So if your XSL generates an entire XHTML document...
> forget it.
>
> (I presume it goes without saying that the first thing this code snippet
> has to do is test whether it's running on Internet Explorer or a
> standards compliant browser. :-P Some things never change...)
>
> So it looks like I'm going to have to sit down and write a special tool
> to take an XML file and copy it, inserting the correct XSL reference
> into the header. How pathetic...
I coded one up in C# in about 15 minutes. It doesn't take much if your language
of choice already has a library for handling xml/xslt.
I found this post rather interesting as my current project is one big stylesheet
to turn raw xml into a legible report. I've learned just how powerful the
language is. There's a ton you can do with it, and I now wonder why everyone
always moans and groans about how difficult it is to deal with.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 09/03/2012 20:56, Warp wrote:
> Nothing stops you from using&#xx; codes regardless of the encoding.
Correction: The finite limitations of the human mind stop you using hex
codes. :-P
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> <?xml version="1.0" encoding="ISO-8859-1" ?>
>
> Gaah! No! Use UTF-8! 8859-1 is Western European/United States only!
Tell it to [every piece of Windows software that inspects text files].
All of these programs seem to default to that encoding, not UTF-8.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
>> Fortunately, using the wonders of XSL (specifically, XSLT) you can have
>> the browser transform the raw XML into a pretty-looking XHTML document.
>>
>> But *only* if you edit the original XML file to mention the XSLT file
>> that you want to apply.
>
> I coded one up in C# in about 15 minutes. It doesn't take much if your language
> of choice already has a library for handling xml/xslt.
It only takes 15 /seconds/ to type in a command if you have a 3rd party
external XSLT processor (e.g., Saxon). But apparently you can't get the
/web browser/ to do this. You have to create a new, separate,
transformed version of the file.
It might not sound like much, but it means every time you change the
program that generates the XML, you can't just rerun that program. You
have to rerun the program, and then rerun Saxon (or whatever), and then
reload the browser page. It's a PITA.
What I ended up doing, obviously, was providing a way to change the XSL
reference that the original program inserts into the XML file. :-P
> I found this post rather interesting as my current project is one big stylesheet
> to turn raw xml into a legible report. I've learned just how powerful the
> language is. There's a ton you can do with it, and I now wonder why everyone
> always moans and groans about how difficult it is to deal with.
[I presume you're talking about XSLT here.]
It's interesting that there's one set of facilities for processing the
input functionally, and a separate, redundant set for processing it
imperatively. The latter set is much less powerful to boot. (Perhaps
that was deliberate.)
What I can't figure out is this: How do I make it process an element one
way if it contains a "small" amount of content, and process it a
different way if it contains a "large" amount of content?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Le 2012-03-09 16:37, Orchid Win7 v1 a écrit :
> On 09/03/2012 20:56, Warp wrote:
>
>> Nothing stops you from using&#xx; codes regardless of the encoding.
>
> Correction: The finite limitations of the human mind stop you using hex
> codes. :-P
step 1: www.google.com
step 2: "unicode chart for _____ characters"
step 3: File | print
step 4: Tape to side of computer screen.
Back when dinosaurs roamed the Earth, that's what most of us did for
DOS-based editors when we needed accented characters, or for the more
daring, ASCII graphics.
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* gmail.com */}camera{orthographic location<6,1.25,-6>look_at a }
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Le 2012-03-09 16:38, Orchid Win7 v1 a écrit :
>>> <?xml version="1.0" encoding="ISO-8859-1" ?>
>>
>> Gaah! No! Use UTF-8! 8859-1 is Western European/United States only!
>
> Tell it to [every piece of Windows software that inspects text files].
> All of these programs seem to default to that encoding, not UTF-8.
Change your local settings to Bulgaria or Czech Republic and it won't!
--
/*Francois Labreque*/#local a=x+y;#local b=x+a;#local c=a+b;#macro P(F//
/* flabreque */L)polygon{5,F,F+z,L+z,L,F pigment{rgb 9}}#end union
/* @ */{P(0,a)P(a,b)P(b,c)P(2*a,2*b)P(2*b,b+c)P(b+c,<2,3>)
/* gmail.com */}camera{orthographic location<6,1.25,-6>look_at a }
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 10/03/2012 01:08, Francois Labreque wrote:
> Le 2012-03-09 16:38, Orchid Win7 v1 a écrit :
>>>> <?xml version="1.0" encoding="ISO-8859-1" ?>
>>>
>>> Gaah! No! Use UTF-8! 8859-1 is Western European/United States only!
>>
>> Tell it to [every piece of Windows software that inspects text files].
>> All of these programs seem to default to that encoding, not UTF-8.
>
> Change your local settings to Bulgaria or Czech Republic and it won't!
Won't default to UTF-8? Yes, I know. ;-)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 3/9/2012 2:56 PM, Warp wrote:
> Mike Raiford<no.### [at] spam me> wrote:
>>> <?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.
>
> Nothing stops you from using&#xx; codes regardless of the encoding.
>
This is true, but, in general, UTF-8 is the better way to go, but if the
data displayed on the page comes form a different source...
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 3/9/2012 3:38 PM, Orchid Win7 v1 wrote:
>>> <?xml version="1.0" encoding="ISO-8859-1" ?>
>>
>> Gaah! No! Use UTF-8! 8859-1 is Western European/United States only!
>
> Tell it to [every piece of Windows software that inspects text files].
> All of these programs seem to default to that encoding, not UTF-8.
That's because nobody bothers with the encoding. But what drives me nuts
is when web-authors stick in an encoding, then use UTF-8 characters in
it. You get all sorts of ugliness.
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On 3/9/2012 3:43 PM, Orchid Win7 v1 wrote:
> What I can't figure out is this: How do I make it process an element one
> way if it contains a "small" amount of content, and process it a
> different way if it contains a "large" amount of content?
Use xsl:choose and have the when statements with the appropriate test?
I'm unclear as to what constitutes a small amount of content v.s. a
large amount of content.
You could have it trigger on the string-length of the node's value, for
instance. Or, you could trigger on the number of nodes (using count)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |