[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Vocabulary Combination and optional namespaces
Joe Gregorio <joe@b...> wrote: | Well, in the given example there isn't an _XML_ problem, since we *know* | that there won't be any name collisions. Name collision is an illusion. The illusion stems from an ill-considered application of *defaulted* understandings of the single vocabulary case to that of multiple vocabularies. Basically, when multiple vocabularies are in play, you can't automatically assume - i.e. as a default - the vocabulary to which a generic identifier (or attribute name) should be imputed; or for that matter, that there is only one relevant generic identifier for the particular element. You need control information associated with the use of each vocabulary at every start tag (i.e. for each element structure): - whether a generic identifier applies (for that vocabulary) and if so where to get it; which *could* be the "expected" generic identifier position in the tag but need not be. - whether any attribute specifications apply, and if so, how to find them (just like the gi identification consideration above). - whether immediate text content is part of the vocabulary specific partition of the document. Note that the single vocabulary case is just a matter of defaulting these three considerations ("Yes, the GI is where you ordinarily expect it to be; yes, all the atribute specifications count as is; and yes, include the text content") so that no *explicit* control information need be encoded in any tag. (But you *do* have to declare this fact, somehow) By contrast, when you already know that defaults *don't* work, you can use the control information to shuffle things around so they don't get in each other's way. This necessarily means having to find vocabulary specific names in places other than the now obviously inapplicable defaults. By way of illustration, consider this reworking of the example in the OP. It's unnecessarily verbose, but it shows how control information can be used to "disambiguate" as the author may desire: <?xml-map vocab="http://www.w3.org/HTML/1998/html4" gi-mapper="hn" att-renamer="ha" text-controller="ht" ?> <?xml-map vocab="http://www.xml.com/books" gi-mapper="xn" att-renamer="xa" text-controller="xt" ?> <A hn="html"> <B hn="head"><C hn="title">Book Review</></> <D hn="body" xn="bookreview"> <E xn="title" ht="no">XML: A Primer</> <F hn="table"> <G hn="tr" foo="center" ha="align foo"> <H hn="td" xt="no">Author</><I hn="td" xt="no">Price</> <J hn="td" xt="no">Pages</><K hn="td" xt="no">Date</></> <L hn="tr" bar="left" ha="align bar"> <M hn="td" xn="author">Simon St. Laurent</> <N hn="td" xn="price">31.98</> <O hn="td" xn="pages">352</> <P hn="td" xn="date">1998/01</> </></></></> Note that *none* of the syntactically visible names belong to either of the two relevant vocabularies. They don't have to: the control attributes completely reconstruct the vocabulary specific views. If you want to use vocabulary specific names in syntactically visible positions, you could do something like this: <?xml-map vocab="http://www.w3.org/HTML/1998/html4" gi-mapper="hn" att-renamer="ha" text-controller="ht" auto-map="true" ?> <?xml-map vocab="http://www.xml.com/books" gi-mapper="xn" att-renamer="xa" text-controller="xt" auto-map="false" ?> <html> <head><title>Book Review</></> <body xn="bookreview"> <title ha="!gi !nil" ht="no" xa="!gi !gi">XML: A Primer</> <table> <tr align="center"> <td xt="no">Author</><td xt="no">Price</> <td xt="no">Pages</><td xt="no">Date</></> <tr align="left"> <td xn="author">Simon St. Laurent</> <td xn="price">31.98</> <td xn="pages">352</> <td xn="date">1998/01</> </></></></> Note the <title> just under <body> ;-) Any vocabulary specific view can be read off by following the pattern of control attributes for that vocabulary only. Like I said, name collision is an utter and complete illusion. | The problem comes about if you tried to combine RSS with another XML | vocabulary whose elements also resided in the nil namespace. No problem as long as markup is used to tell the difference. Heck, that's what markup is for! The interesting fact is that not only are colons or multi-part names not needed for this, but also such syntactically intrusive devices can complicate or preclude solving the problem in the general case. In fact, I've demonstrated a class of methods (using control attributes) to solve these problems: 1. Allow any vocabulary to be mapped to any partition of the document. 2. Allow this for multiple vocabularies uniformly, catering to both exclusion and overlap. Not just that, I've done it with nary a colonified name in sight. Never mind that I don't even have "xlink:href versus html:src" problems here! And for that, I'm supposed to be a troll? Sheesh.
|
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
|