Discuss: Inline XML
by Lachlan Cannon
- Editorial Comments
2 NYPL link correction
Heads up. The NYPL style guide referenced in the story is actually http://www.nypl.org/styleguide/xhtml/guidelines.html instead of http://www.nypl.org/styleguide/XHTML/guidelines.html. Apparently the caps make a difference. Great article by the way.
posted at 05:11 am on November 1, 2002 by Eric J
3 Example, please?
Any way you could toss in the referenced code marked up as specified by the author? Would be nice to be able to see how it looks in different browsers without having to recreate the snippet on my own.
posted at 05:58 am on November 1, 2002 by Tk
4 Render example!
Yeah, let’s see the example rendered in the article.
posted at 06:13 am on November 1, 2002 by
5 Question
Interesting article, but you make one point I’m not sure I understand:
“Alternatively, we could use <span>s and classes to mark up all the code. However, this approach is almost as bad as the <font> one. Yes, we’re using CSS instead of embedding presentation inside the structure, but we’re also burying semantic meaning inside our class attribute. “
Burying semantic meaning inside our class attribute? You lost me there. A class attribute is just a name, it might as well be a gid or other code. It doesn’t have to have semantic meaning at all, but what it SHOULD do is tell you what kind of <foo> our <foo> is. Seems to me that that’s the whole point, isn’t it?
I guess what I don’t understand is why it’s a problem, or something to be avoided. <var class=“global”> and <var class=“lexical”> seem to me like useful applications of the class attribute.
Or are you saying you want to be able to set a “type” on a tag without attaching it to a presentation rule in a stylesheet? <var type=“global” class=“wicked-important”>?
(hope the parser escapes the pseudo-tags in this post; if not, I’ll repost without them.)
posted at 06:59 am on November 1, 2002 by Steve Linberg
6 Re: Question
What Lachlan meant was that the class attribute is often used on the generic span tag to denote some level of information. For example <span class=“author”>Lachlan</span> would denote the author to someone reading the code. “Author” is not a type of span, span being a generic container for styling.
http://www.w3.org/TR/html4/struct/global.html#h-7.5.4
posted at 08:38 am on November 1, 2002 by mad_city_man
7 Re: Question
Mad City Man, the URL you provided to the HTML spec seems to back up the point that Steve brought up. According to the spec, the class attribute is appropriate “to achieve the desired structural and presentational effects” … “since HTML does not include elements that identify objects such as “client”, “telephone number”, “email address”, etc.”
I’d say that the class attribute should definitely be used to embed semantic distinctions— that’s what it’s there for.
Lachlan wrote: “Marking content up by what it means, and letting anything that browses the document, human or machine know what that meaning is.”
Well… not exactly. If you just make up new dialects all the time, like the one in this article, then humans or machines can’t just automagically know what the markup “means”. For anything to be meaningful, there has to be some agreement beforehand. So, embedding terms from the Dublin Core might be useful, but the markup used in this article is no more useful— but precisely as “meaningful”— as using DIVs and SPANs with class attributes.
(Except that the inline XML method won’t have the desired results in some major browsers. Reality is such a pain.)
posted at 03:49 pm on November 1, 2002 by sco
8 Beginners Lack Of Luck
Ok, I’m not getting one bit of this article and I’m assuming it is because I am missing a basic understanding of XML. I do get XHTML and CSS, but never managed to figure out the purpose or use of XML (but I do see the power in it). I’m assuming I’m missing some basic general understanding, so could someone show me a site/tutorial, or maybe even help a newby out and explain this for me?
posted at 06:56 pm on November 1, 2002 by Stephen
9 Difficult to have discussion...
without a reasonable example. I’ve done custom tags by namespaces but many who will read the article have not. They will need to see results. The author has come up with an excellent reason to apply this technique, so follow-thru can be esp. helpful here.
Mozilla devotees may point out that browser as capable of styling custom tags directly. This is easier and more intuitive but the namespace route is better in the long run for the reasons the author gave.
Pretty slick!
posted at 07:06 pm on November 1, 2002 by Brett
10 Re: Difficult to have discussion
I have now posted the example used in this article on my site at http://illuminosity.net/writing/articles/inlinexml/colon-escape.html for people to see in its full “glory”. With regards to the class versus namespaces issue, classes are no doubt the solution to be used for now, for reasons of browser support etc, however namespaces allow easier styling and parsing of the extra elements once they are well supported. for example to give the style class the equivalent of the php type attribute I use one would would have to create variants within the class, such as class “script php”. Once you start wanting a few different attributes this method becomes very messy to understand, and harder to parse if you want to draw specific things out of your example. If, for example, you wanted to collect all scripts on your site, it’s much easier to look through for elements <s:script>, than for <div class=“script”>. there are other reasons to get to know namespaces too, such as combining existant xml languages together, such as svg with xhtml, or mathml with svg.
This article, rather than trying to trigger a holy war about the best methods to use was instead meant to be a simple introduction to how to use namespaces within xml documents.
posted at 11:01 pm on November 1, 2002 by Lach
Discussion Closed
New comments are not being accepted, but you are welcome to explore what people said before we closed the door.
Got something to say?
Discuss this article. We reserve the right to delete flames, trolls, and wood nymphs.
Create a new account or sign in below if you’d like to leave a comment.
Subscribe to this article's comments: RSS (what’s this?)



1 title
test
posted at 05:00 am on November 1, 2002 by