Re: [xml] Does libxml parse html like browsers?




--- Daniel Veillard <veillard redhat com> wrote:
Also, is there an example specific to parsing
HTML? Or

  xmllint --html code. 


Way to big to make heads and tails of it.

is the procedure the same as for xml with the
xmlXXXXXXX commands replaced with their
htmlXXXXXXX equivalents?

  basically yes
[...]
  yes, but the best way it to *try* it ! libxml2


Yes, well, I've "*tired*" it, with no useful results;
since I'm reading off memory, and since it's suppose
to work like parsing xml, I did it the same way:

xmlDocPtr processSourceCode(char* cString,char*
encoding, char* url)
{
                
        /* try to parse the code as XHTML */
        xmlDocPtr receiver = xmlReadMemory(cString,
strlen(cString), "noname.xml", encoding,
XML_PARSE_NOERROR);
        
    if (receiver == NULL) 
        { /* not valid XML doc? pase it as html */
           receiver = htmlReadMemory(cString,
strlen(cString), url, encoding, NULL);
    }
   return receiver;
}

I get all the HTML warning errors, but receiver stays
NULL.  So, if it 'bascially' works the same, how come
this method doesn't work?



 


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]