[whatwg] foreign attributes Re: several messages about XML syntax and HTML5

On Tue, 5 Dec 2006, Elias Torres wrote:
>
> [...]

I'm having trouble understanding what you're doing.

Could you provide some actual code examples? They can be fictional, I'm 
just trying to work out what you're doing.


For example:

> At the moment we have data defined using by XML schemas that are used by
> customers to describe industry-specific information such as automotive
> parts.

I don't understand why you would be sending this information in HTML 
documents.


> > RDFa gives you no more than HTML5's parsing algorithm does -- you 
> > still just end up with an arbitrary blob of data, the meaning of which 
> > you have to define.
> 
> I respectfully disagree. I'm not sure how familiar you are with RDFa but 
> it gives specific instructions on how to find/extract tagged data within 
> the page.

Again, could you give some specific code samples to demonstrate this?



> HTML pages are one possible representation of resources.  These 
> resources have data models that exist beyond the html page, frequently 
> they exist as xml. When these resources are rendered as html we would 
> like to still be able to tie the visual representation back to the 
> underlying data model.  This allows us, for example, to deduce that a 
> person, an event or a customer order is on the page.

I don't understand why you can't just include the information like this:

   <p class="ibm-order">
    <span class="ibm-customer">
     <span class="ibm-name">Ian Hickson</span>
     (<span class="ibm-id">95237032895</span>)
    </span>
    has purchased a
    <span class="ibm-part">
     <span class="ibm-name">Widget x12</span>
     (part ID <span class="ibm-id">295250X12</span>)
    </span>
   </p>
   <p class="ibm-order ibm-deleted">
    ...
   </p>

You can then process this simply:

   // find all the orders on the page:
   var orders = document.getElementsByClassName(['ibm-order']);
   // process them
   for (var i = 0; i < orders.length; ++i) {
     var order = orders[i];
     // if it's deleted, ignore it
     if (order.className.has('ibm-deleted'))
       continue;
     // get the customer ID
     var userID = order.getElementsByClassName(['ibm-customer'])
                       .getElementsByClassName(['ibm-id'])
                       .textContent;
     // get the part ID
     var partID = order.getElementsByClassName(['ibm-part'])
                       .getElementsByClassName(['ibm-id'])
                       .textContent;
     // add this user/part to the list:
     addToList(userID, partID);
   }

What would this look like in your ideal world? Could you give some 
examples of what the above would be like, with code samples?

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'

Received on Tuesday, 5 December 2006 14:29:55 UTC