Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i have one code html:

XML
<div id="grid" style="margin-right: 505px; height: 700px;">
            <div class="box-content" style="width: 99%;">
                <div class="contenttitle">
                    <div class="left-hd">
                    </div>
                    <div class="right-hd">
                        Thông tin thị trường giờ tới</div>
                </div>
                <div class="inner">
                    <div style="margin-left: 5px; margin-right: 8px;">

<style type="text/css">
    .RadGrid_Office2007 .rgHoveredRow
    {
        background-color: lightyellow !important;
        background-image: none !important;
    }

    .RadGrid_Office2007
    {
        border-radius: 10px 10px 10px 10px;
    }
    .headerLeft
    {
        border-top-left-radius: 10px !important;
    }
    .headerRight
    {
        border-top-right-radius: 10px !important;
    }
    .RadButton_MetroTouch.rbToggleButton.rbTextButton .rbText
    {
        background-color: transparent;
        font-size: 13px;
        font-family: Arial !important;
        text-align: center;
        font-style: italic;
        color: Blue;
    }
</style>
<div>
    <span id="ctl00_panelContent_ctl01_ucThongTinThiTruong_lblErr"></span>
</div>
<div>
    <div id="ctl00_panelContent_ctl01_ucThongTinThiTruong_grdTT" class="RadGrid RadGrid_Office2007 rgMultiHeader" style="height:700px;width:100%;">

        <div class="rgHeaderWrapper"><div id="ctl00_panelContent_ctl01_ucThongTinThiTruong_grdTT_GridHeader" class="rgHeaderDiv" style="padding-right:16px;overflow:hidden;">



i have using HtmlAgilityPack parse data on webbrowser, Now I want to use xpath to get the data they must do how

code HtmlAgilityPack:



C#
        var document = webBrowser1.Document;
        var documentAsIHtmlDocument3 = (mshtml.IHTMLDocument3)document.DomDocument;

        var htmlString = documentAsIHtmlDocument3.documentElement.innerHTML;

        HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
        doc.LoadHtml(htmlString);


        HtmlNodeCollection texts = doc.DocumentNode.SelectNodes("//div[@class='box-content']//div[@id='ctl00_panelContent_ctl01_ucThuyVan_grdGiaTriNuoc_GridData']");
        string kq = "";

        if (texts != null)
        {
            foreach (var item in texts)
            {
                kq += item.InnerText + Environment.NewLine;
            }
        }
        richTextBox1.Text = kq;

    }
}
Posted
Updated 24-Jul-15 1:53am
v2

1 solution

http://www.codeproject.com/Articles/9494/Manipulate-XML-data-with-XPath-and-XmlDocument-C

Check the link... It will help you
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900