Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9013815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:21:42+00:00 2026-06-16T03:21:42+00:00

Context: I am trying to parse the Cities from this Page here . I

  • 0

Context:

I am trying to parse the “Cities” from this Page here. I already managed to simulate the request for the data of this combobox, which is a Ajax call.

Fiddler Request :

POST http://www.telelistas.net/AjaxHandler.ashx HTTP/1.1
Host: www.telelistas.net
Connection: keep-alive
Content-Length: 106
Origin: http://www.telelistas.net
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko)      Chrome/23.0.1271.97 Safari/537.11
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept: */*
Referer: http://www.telelistas.net/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: cert_Origin=directo; email=bdc.testes@gmail.com; auto=automatico=0; searchparameters=bottom=0&btnsite=0&email=&uf=rj&origem=0&nome=&pagina=1&codlogradouro=&predio=213&tiquete=0&localidadeendmap=&codbairro=0&pcount=25&estacionamento=0&letra=&top=&entrega=0&pchave=&info=&logradouro=rua+da+lapa&codtitulo=-1&chave=&zoom=&comercial=0&ddd=0&comib=0&btnemail=0&pgresultado=&localidade=&telefone=&manobrista=0&codlocalidade=21000&site=&cartoes=0&atividade=&bairro=&reserva=0&residencial=0; perfil=logged=1&iduser=2563063&email=bdc.testes@gmail.com&usertype=2&specialsearch=3&siteusernome=BigDataCorp&siteuserdatanasc=15/01/1988&siteusersexo=M&siteuserlocalidade=21000&siteuseruf=RJ&siteuserddd=21&siteusertelefone=94118439&siteuserprofissao=4&siteuserrenda=5000&siteuserformacao=4&siteusernovidades=0&siteusernovidadesrevista=&siteusernovidadesparceiros=0&siteusercpf=10541308769&siteuseracesso=brasil&siteusercep=22631000&siteuseridade=24&siteuserparceiro=telelistas&siteuserconhecimento=2&siteuseroperadora=oi&siteuserurlorigem=http://www.telelistas.net/&siteuserdatacadastro=13/12/2012 11:45:00; __utma=70879631.392027796.1355939587.1356014801.1356021821.5; __utmb=70879631.1.10.1356021821; __utmc=70879631; __utmz=70879631.1355939587.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)

PostData : state=rj&style=busca_interna&selectedCity=21000&clientId=pch_localidade_select&method=GetSearchCitiesNamed

Issue:

Here is a fragment of the string returned by this request :

<select name='pch_localidade_select' class='busca_interna' id='pch_localidade_select' tabindex="4"><option value="">Selecione</option><option selected value="21000">Rio de Janeiro</option><option value="21380">Abraão</option><option value="21001">Afonso Arinos</option><option value="21002">Agência Luterback</option><option value="21847">Agriões de Dentro</option>

What i am trying to do, is to reach the InnerTextof the Option tags (“Rio de Janeiro”, “Abraao”…), but for some weird reason, the InnerText is always empty, for every option node found.

There’s some code fragment that is failing :

        // Iterating over nodes to build the dictionary
        foreach (HtmlNode city in citiesNodes)
        {
            string key   = city.InnerText;
            string value = city.Attributes["value"].Value;

            citiesHash.AddCity (key,value);
        }

Technology in Place:

I am using HtmlAgilityPack that supports XPath syntax for node selecting, C# code and Fiddler2 for WebDebugging.

Thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T03:21:43+00:00Added an answer on June 16, 2026 at 3:21 am

    For some weird reason, HtmlAgilityPack does not handles those tags correctly, so this managed to solve my problem.

            // Iterating over nodes to build the dictionary
            foreach (HtmlNode city in citiesNodes)
            {
                if (city.NextSibling != null)
                {
                    string key   = city.NextSibling.InnerText;
                    string value = city.Attributes["value"].Value;
    
                    citiesHash.AddCity (key,value);
                }
            }
    

    Instead of reaching directly the node,i managed to get the values of each node by using the NextSimbling reference from the previous simbling.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use this code which is an example taken from here https://gist.github.com/2383248
Here is a snippet from the XML file I am trying to parse: <Item
I am getting a HttpservletRequest from client, i am trying to parse the request
Possible Duplicate: How to retrieve JSON via ASP.Net context.Request Im trying to parse an
I'm trying to parse some XML from the USGS. Here's an example The parameterCd
I'm trying to parse the result from a RESTFull call using RestTemplate following this
I'm trying to parse large XML files (>3GB) like this: context = lxml.etree.iterparse(path) for
I'm using Parse.com server and i'm trying to get data from the server and
Context I'm trying to have some "plugins" (I'm not sure this is the correct
Context: I am trying to perform a custom animation from a normal UIViewController.view to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.