Saturday, 17 August 2013

hi all, a question about libhubbub and namespace

Hi all.

I was reading the example libxml.c provided in the src of libhubbub.
And found that it assumed that all html page had namespaces below:

/**
 * Mapping of namespace prefixes to URIs, indexed by hubbub_ns.
 */
static struct {
    const char *prefix;
    const char *url;
} namespaces[] = {
    { NULL, NULL },
    { NULL, "http://www.w3.org/1999/xhtml" },
    { "math", "http://www.w3.org/1998/Math/MathML" },
    { "svg", "http://www.w3.org/2000/svg" },
    { "xlink", "http://www.w3.org/1999/xlink" },
    /** \todo Oh dear. LibXML2 refuses to create any namespace with a
     * prefix of "xml". That sucks, royally. */
    { "xml", "http://www.w3.org/XML/1998/namespace" },
    { "xmlns", "http://www.w3.org/2000/xmlns/" }
};

However, take aol.com as example. It has namespaces below:
<!DOCTYPE html>  <html xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" class="Gecko ff2" id="global-header-light">  ... ...    
So, the Question is: how to automatically create namespaces for html pages such as aol.com ?

Thanks a lot.

No comments:

Post a Comment