NADAV: How do behaviors relate to XML? What are the advantages of using XML syntax?
MICHAEL: With IE 5, we allow XML to intermix with HTML and for authors to apply CSS properties to XML to control its display. Since the behavior property is implemented just like a CSS property, it's easy to apply behaviors to XML.
The big advantage of using XML syntax with behaviors is to make the syntax more understandable for designers. Its easier to understand that if you want to have something fly from the left, to wrap the <MY:FLYIN> tag around it, as opposed to doing something like <div style="behavior: url(...)">. It's an abstraction to make life easier.
NADAV: Speaking of XML ... by making it possible for - even encouraging - page authors to define new tags (such as <FLYIN> or <POPUP>), aren't you subverting the original purpose of behaviors, which was to separate behavioral information from document data? Why not just use CSS selectors? What advantages does this tag-based approach have?
MICHAEL: Well, the <My:FLYIN> tag really isn't about data - it's about custom presentation. I think we are seeing another use for XML which isn't technically data, but more like semantic markup. It seems clear that applying behaviors to semantic markup delivers a lot of value, and is easily understandable for both. We still have separated behavior from style, markup, and data because the semantic markup still exists without the attached behavior. For example, if I had the following:
<My:News>
<My:Headline>Some Headline</My:Headline>
<My:Content>Some Content</My:Content>
</My:News>
If I have a stylesheet that makes a headline blue, or makes it fade in, the behavior, style, markup, and data are still separated. There is no intrinsic linkage. This XML-based syntax also seems easier to read and understand. Using SPAN or DIV and applying CSS to it would be exactly the same, only less clear.
next page»