[yunqa.de] Re: How to get the sourcecode of a TABLE?

  • From: "Bear Xu" <bear.xy@xxxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Sun, 30 Mar 2008 19:18:04 +0800

Thank you
I checked the XML tree example:

 FDocTree := htmlParseFile(PAnsiChar(Utf8Encode(AFileName)), nil );
   XML_TEXT_NODE, XML_CDATA_SECTION_NODE, XML_PI_NODE, XML_COMMENT_NODE:
          begin
            p := xmlNodeGetContent(xmlNode);
            memoDetails.Text := Utf8Decode(p);
            FreeMem(p);
          end;

but i seems that can now show Chinese correctly on Chinese Windows.
The webpage is UTF-8 or GB2312 , they are Chinese Page, like www.baidu.com
The result memo show much ?? etc. not correct.

How do I change the code?
Thank you!

Bear





On Thu, Mar 27, 2008 at 3:22 PM, Delphi Inspiration <delphi@xxxxxxxx> wrote:

> Hello Bear Xu,
>
> >TDIHtmlParser.HtmlTag.Code can only get the source code when parsing.
>
> Correct. The parser only stores the current piece of HTML to keep memory
> requirements to an absolute minimum.
>
> >I mean after the parsing processed the last tag : </HTML>,
> >does it store some information in memoery like DOM?
>
> For performance, DIHtmlParser does not generate and store DOM trees. DOM
> can be useful, but is not necessarily needed for most HTML parsing tasks.
>
> >So I can get the code or text of any tag I want.
>
> You can do so with DIHtmlParser even without DOM: Just collect the code of
> all tags (and text, etc.) to a string variable. You can speed up Delphi's
> default string concatenation with the ConCat... family of functions in
> DIUtils.pas.
>
> >Do you provide some product that parsing the HTML into DOM then we can
> fetch the node tree?
>
> DIXml creates DOM trees from both XML and HTML documents. Look at the
> DIXml_Node_Tree demo for an example -- and make sure to check "Load as HTML"
> if it is not automatically detected.
>
> Ralf
>
> _______________________________________________
> Delphi Inspiration mailing list
> yunqa@xxxxxxxxxxxxx
> //www.freelists.org/list/yunqa
>
>
>
>

Other related posts: