[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Vocabulary Combination
Arjun Ray wrote: > We have it from unimpeachable authority that the Namespace mechanism isn't > really for "vocabulary combination" (even though the "Motivation" section > of the spec would seem to suggest that it might be). Thus in > > http://www.xml.com/pub/a/1999/01/namespaces.html > > it is written: "The only reason namespaces exist, once again, is to give > elements and attributes programmer-friendly names that will be unique > across the whole Internet." Don't be silly. Why would you want names that are unique on a wide scale if you weren't going to be combining vocabularies? > <h:html xmlns:xdc="http://www.xml.com/books" > xmlns:h="http://www.w3.org/HTML/1998/html4"> > <h:head><h:title>Book Review</h:title></h:head> > <h:body> > <xdc:bookreview> > <xdc:title>XML: A Primer</xdc:title> > <h:table> > <h:tr align="center"> > <h:td>Author</h:td><h:td>Price</h:td> > <h:td>Pages</h:td><h:td>Date</h:td></h:tr> > <h:tr align="left"> > <h:td><xdc:author>Simon St. Laurent</xdc:author></h:td> > <h:td><xdc:price>31.98</xdc:price></h:td> > <h:td><xdc:pages>352</xdc:pages></h:td> > <h:td><xdc:date>1998/01</xdc:date></h:td> > </h:tr> > </h:table> > </xdc:bookreview> > </h:body> > </h:html> > > Let's suppose I want to reconstruct an "html view" and a "books view" of > this document. Interesting thought experiment. Why did you leave the <h:head><h:title> construct out of the HTML view? Upon reflection, I'm not convinced that this "views" approach is useful. Merely subtracting any of the markup vocabularies is almost never apt the right thing to do. If what you're trying to do is display this, you'd need either to generate some reasonable HTML from the xdc: stuff, or conceivably leave it in that space and render with CSS. Probably achievable right now in some browsers. > and for the books-vocabulary: > > <bookreview> > <title>XML: A Primer</title> > <author>Simon St. Laurent</author> > <price>31.98</price> > <pages>352</pages> > <date>1998/01</date> > </bookreview> Hm, on reflection, this view kind of makes sense (seen as input to an RDBMS loader for example), while the HTML one really doesn't. > If this is acceptable, then my question is: What is the decision procedure > by which a generic parser-level filter could generate these views, if it's > to take namespaced names as a guide? Totally application-dependent, I'd think. It doesn't seem likely that "generic parser-level filter" is a very useful construct. > "It can't be done" is an acceptable answer, btw. In the general case, it can't be done. The namespaces don't give you enough information. Even if you know it's HTML, you might be mining it to populate a full-text index rather than rendering it, in which case your selection of views is really different. I hope there's nobody who really thinks that knowing what namespace something in is provides normative guidance on what you ought do with it. The beauty of XML is that the provider of the data doesn't get to exercise any fiat over the behavior of the consumers. -- Cheers, Tim Bray (ongoing fragmented essay: http://www.tbray.org/ongoing/)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|