Finding the right entry

Hello Community,

it's again me with my next problem. As I mentioned, I'm pretty new in 
programming and have no clue about all this different techniques. So I hope 
you can help me.

What I wanna do is theoretically simple. Providing a phonenumber  to an URL 
over the internet I get the complete phonebook entries (companyname, street, 
city...).  The received data are packed in a atom-feed (that's a sort of 
specific xml).  The following code shows how the call should work:

    Private Sub RetrieveWebEntries()
        Dim url As String
        Dim xmlDoc As New XmlDocument()
        Dim rssFeed As HttpWebRequest
        Dim element As XmlElement

        url = "http://tel.search.ch/api/?was=0319984589&key=mykey"

        rssFeed = WebRequest.Create(rssUrl)

        If rssFeed IsNot Nothing Then
            xmlDoc.Load(rssFeed.GetResponse().GetResponseStream())
        End If

        element = xmlDoc.GetElementById("tel:firstname")

        Return xmlDoc
    End Sub

If i have a look in the xmlDoc.outerXML this is what I get:

  <?xml version="1.0" encoding="ISO-8859-1" ?>
- <feed xml:lang="de" xmlns="http://www.w3.org/2005/Atom" 
xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" 
xmlns:tel="http://tel.search.ch/api/spec/result/1.0/">
  <id>http://tel.search.ch/api/8f527a80ea99ac0922a55242ad61f207/e200bbd80c50d55fcac271ca3194ff2c</id>
  <title type="text">tel.search.ch API Search Results</title>
  <generator version="1.0" 
uri="http://tel.search.ch">tel.search.ch</generator>
  <updated>2010-01-19T03:00:00Z</updated>
  <link href="http://tel.search.ch/result.html?was=0319984589" 
rel="alternate" type="text/html" />
  <link href="http://tel.search.ch/api/?was=0319984589&key=mykey" 
type="application/atom+xml" rel="self" />
  <openSearch:totalResults>1</openSearch:totalResults>
  <openSearch:startIndex>1</openSearch:startIndex>
  <openSearch:itemsPerPage>10</openSearch:itemsPerPage>
  <openSearch:Query role="request" searchTerms="0319984589" startPage="1" />
  <openSearch:Image height="1" width="1" 
type="image/gif">http://www.search.ch/audit/CP/tel/de/api</openSearch:Image>
- <entry>
  <id>urn:uuid:40ee9f656a59df9b</id>
  <updated>2010-01-19T03:00:00Z</updated>
  <published>2010-01-19T03:00:00Z</published>
  <title type="text">Microsoft Schweiz GmbH</title>
  <content type="text">Microsoft Schweiz GmbH Morgenstrasse 129 3000 Bern/BE 
031 998 45 89</content>
- <author>
  <name>tel.search.ch</name>
  </author>
  <link 
href="http://tel.search.ch/bern/morgenstrasse-129/microsoft-schweiz-gmbh" 
title="Details" rel="alternate" type="text/html" />
  <link 
href="http://tel.search.ch/vcard/MicrosoftSchweizGmbH.vcf?key=40ee9f656a59df9b" 
type="text/x-vcard" title="VCard Download" rel="alternate" />
  <link href="http://tel.search.ch/edit/?id=40ee9f656a59df9b" rel="edit" 
type="text/html" />
  <tel:pos>1</tel:pos>
  <tel:id>40ee9f656a59df9b</tel:id>
  <tel:type>Organisation</tel:type>
  <tel:name>Microsoft Schweiz GmbH</tel:name>
  <tel:occupation />
  <tel:street>Morgenstrasse</tel:street>
  <tel:streetno>129</tel:streetno>
  <tel:zip>3000</tel:zip>
  <tel:city>Bern</tel:city>
  <tel:canton>BE</tel:canton>
  <tel:category>Softwareentwicklung</tel:category>
  <tel:category>Computer & Peripherieger�te Grosshandel</tel:category>
  <tel:extra type="fax">+41319984589</tel:extra>
  </entry>
  </feed>

No i would like to exctract all the information who start with <tel: >
I tried first looping throug every childnode but nothing. Then I tried using 
"element = xmlDoc.GetElementById("tel:firstname")"
Can it be as complicated? What am I doing wrong? How can I put this outerXML 
(who's a string) in a XML?

Thanks in advance

Trudy 

0
just.spam (2)
1/19/2010 3:19:47 PM
dotnet.xml 7266 articles. 0 followers. Follow

2 Replies
1742 Views

Similar Articles

[PageSpeed] 14

Trudy Momo wrote:

> What I wanna do is theoretically simple. Providing a phonenumber  to an 
> URL over the internet I get the complete phonebook entries (companyname, 
> street, city...).  The received data are packed in a atom-feed (that's a 
> sort of specific xml).  The following code shows how the call should work:
> 
>    Private Sub RetrieveWebEntries()
>        Dim url As String
>        Dim xmlDoc As New XmlDocument()
>        Dim rssFeed As HttpWebRequest
>        Dim element As XmlElement
> 
>        url = "http://tel.search.ch/api/?was=0319984589&key=mykey"
> 
>        rssFeed = WebRequest.Create(rssUrl)
> 
>        If rssFeed IsNot Nothing Then
>            xmlDoc.Load(rssFeed.GetResponse().GetResponseStream())
>        End If

There is no need to mess with WebRequest and response and response 
stream, it suffices to use
          xmlDoc.Load(url)

> No i would like to exctract all the information who start with <tel: >

You can use XPath to do that e.g.

         Dim nsMgr As New XmlNamespaceManager(xmlDoc.NameTable)
         nsMgr.AddNamespace("tel", 
"http://tel.search.ch/api/spec/result/1.0/")

         For Each element As XmlElement In 
xmlDoc.SelectNodes("descendant::tel:*", nsMgr)
             Console.WriteLine("Element named ""{0}"" has content 
""{1}""", element.LocalName, element.InnerText)
         Next

-- 

	Martin Honnen --- MVP XML
	http://msmvps.com/blogs/martin_honnen/
0
mahotrash (1777)
1/19/2010 4:47:30 PM
It works great!

Martin, thank you a lot. You made my day =)

Have a nice day

Trudy

"Martin Honnen" <mahotrash@yahoo.de> schrieb im Newsbeitrag 
news:O4bpZcSmKHA.1536@TK2MSFTNGP06.phx.gbl...
> Trudy Momo wrote:
>
>> What I wanna do is theoretically simple. Providing a phonenumber  to an 
>> URL over the internet I get the complete phonebook entries (companyname, 
>> street, city...).  The received data are packed in a atom-feed (that's a 
>> sort of specific xml).  The following code shows how the call should 
>> work:
>>
>>    Private Sub RetrieveWebEntries()
>>        Dim url As String
>>        Dim xmlDoc As New XmlDocument()
>>        Dim rssFeed As HttpWebRequest
>>        Dim element As XmlElement
>>
>>        url = "http://tel.search.ch/api/?was=0319984589&key=mykey"
>>
>>        rssFeed = WebRequest.Create(rssUrl)
>>
>>        If rssFeed IsNot Nothing Then
>>            xmlDoc.Load(rssFeed.GetResponse().GetResponseStream())
>>        End If
>
> There is no need to mess with WebRequest and response and response stream, 
> it suffices to use
>          xmlDoc.Load(url)
>
>> No i would like to exctract all the information who start with <tel: >
>
> You can use XPath to do that e.g.
>
>         Dim nsMgr As New XmlNamespaceManager(xmlDoc.NameTable)
>         nsMgr.AddNamespace("tel", 
> "http://tel.search.ch/api/spec/result/1.0/")
>
>         For Each element As XmlElement In 
> xmlDoc.SelectNodes("descendant::tel:*", nsMgr)
>             Console.WriteLine("Element named ""{0}"" has content ""{1}""", 
> element.LocalName, element.InnerText)
>         Next
>
> -- 
>
> Martin Honnen --- MVP XML
> http://msmvps.com/blogs/martin_honnen/ 

0
just.spam (2)
1/20/2010 7:18:29 AM
Reply:

Similar Artilces:

Assign a Value to a Duplicate Entry Within the Same Column
Within a single worksheet I have thousand-plus rows of data and one of the columns within that worksheet I have a series of numbers. After I've identified the duplicates within that column I want to assign a value based on the first time that number shows up (in this case by I'v sorted by date), so the first duplicate would have a value like "1." I then want to assign the next duplicate(s) sequentially (2, 3, 4, etc.) When finished I would want a new column of data that would have far more "1s" than "2s," more "2s" than "3s,"...

Find First
I am having trouble making this work. I am trying to do a find in a subform. Dim rs As DAO.Recordset If Not IsNull(Me.Command33) Then Set rs = Forms![fAddGroupCat]![fAddGroupCatSub2].[Form].RecordsetClone rs.FindFirst "[Descr2] = """ & Me.Command33 & """" If rs.NoMatch Then MsgBox "Not found" Else Me.Bookmark = rs.Bookmark End If Set rs = Nothing End If Thank you, Steven Also: How can you tell it to start at the last record an...

boolean find criteria in Excel
Is it possible to set up the Excel Find and replace to find a or b or c in a cell of content a,b,c, etc? Thanks! Trent I wouldn't think so. -- Regards, Tom Ogilvy "davista00" <davista00@discussions.microsoft.com> wrote in message news:A20AE105-09AB-4681-AD60-60E08F0345BF@microsoft.com... > Is it possible to set up the Excel Find and replace to find a or b or c in a > cell of content a,b,c, etc? > > Thanks! > Trent ...

Finding Merged Cells
Is there any (easy) way of finding a cell or cells that have been merged? I am trying to sort a (very large) spreadsheet but can't because Excel "...requires the merged cells to be the same size..." I can always select all and remove the merge - but I am wondering why there are merged cells - hence the reason for trying to find them! Many Thanks - I like the macro solution - it certainly works on a test setup - I'll try it on the real spreadsheet tomorrow >-----Original Message----- >Manually, you could divide and conquer. Select half the range, hit ctrl-1 (t...

Help finding Exchange Server or Administrator
I have been unable to use Outlook because I I can't access an Exchange Server or get an HTTP address from an. THese are the messages I continue to get, that doesn't allow me to move forward with use. Help! Do you have an exchange server account? If so, contact your email administrator. If you don't have an exchange account (or if you don't know if you do, you probably don't) then you may need to create a new profile. What version of outlook do you have? If you have an exchange account and use OWA, see http://www.outlook-tips.net/archives/20030904.htm if you want...

Find duplicate cells
Is there a way to find all the cells with identical entry? I'm trying to find duplicate information but I don't know what the duplicate entries are. Find and replace does not have an option to find something like that. TIA, cpliu Hi have a look at http://www.cpearson.com/excel/duplicat.htm#TaggingDuplicates http://www.cpearson.com/excel/duplicat.htm#HighlightingDuplicates -- Regards Frank Kabel Frankfurt, Germany "cpliu" <chanciusliuDeleteThis@yahoo.com> schrieb im Newsbeitrag news:Xns94A16109E4C87chanciusliuDeleteThi@130.133.1.4... > Is there a way to fi...

Trying to find out if I'm hacked.
I am a new Exchange 2003 admin and I'm trying to find out if my sever has gotten hacked. Here are the symptoms: 1. I am getting odd emails from senders liked Bounced Mail and stuff, saying that I've been sending out massive amounts of spam 2. My server is emailing me alerting me that store.exe is allocating more memory than normal. Here is what I have done this far: 1. Checked my server's queue to see if there are bunch of items, there are none. 2. Run my virus scan program several time and found nothing. So on the surface things seem ok, we are still sending and receivi...

Advanced Find 05-22-06
Hi, I would like to search for services details using Advanced Find and make/create a report with the resources information. For example... I would like to know the users that are working on a specified service? or What resources groups the user belongs and then make a report with that information. If i go throw the resource group area i can create a report with that information, but it doesnt include the user email for example. Any sugestion how this could be done? thx ...

Advanced Find in contact's birthday problem
Hi, I'm having a simple problem in MS CRM 3.0 regarding advanced find with Contact's birthday. My filter criteria is Contact's Birthday as entity and operator "Today". The result is nothing. But when I checked the birthday of one of the contact, there exists at least one. I noticed that the advanced find also matching the year. when I changed the birthday from 7/20/1954 to 7/20/2006, the advanced find output the result. How can we go about this problem? True, this is one of the thing I hope Microsoft will implement in the next version (or better service pack :)) ...

ADO FIND question
I have a VB program accessing non-indexed tables (by primary key). I'm using the RECORDSET.OPEN / RECORDSET.FIND syntax, coupled with RECORDSET.MOVENEXT. I would like to be able to stop the quesry when the last record with my specified value is found. How can I do that when the field I'm using is not indexed (even though it's a key field)? Any insight would be appreciated. Thanks! A primary key is an index. I'm not sure that I understand the rest of your question. How is your code supposed to know that the last record to match your criteria is the last record without...

Cannot find GWL97.xla
when I try to open or close a file in other then safe mode xl flashes cannot find GWL97.xla, I am using office 97, everything works of in safe mode. Can anyone Help, I am new at excell, but am used to lotus 123. "Roger Poor" <r.poor@worldnet.att.net> wrote in message news:03cf01c347b4$70ecd340$3501280a@phx.gbl... > when I try to open or close a file in other then safe mode > xl flashes cannot find GWL97.xla, I am using office 97, > everything works of in safe mode. Can anyone Help, I am > new at excell, but am used to lotus 123. I beleive GWL97.xla is a Groupwi...

DirSync of Novell Connector, doesn't find existing users
DirSync of Novell Connector, doesn't find existing users ...

Macro to find the first cell in a column with different data
Hello, I really could use some of your expert and excellent help with a problem I am having in creating a macro to perform a search in "Column A" to locate a change in the data in that column and then move one column to the right and one row down and type "1" in that cell. I really appreciate your help, and Have a Blessed Holiday Season. Perhaps this might also do it here .. Assuming data is in A1 down, of the structure as below: 1 1 1 2 2 3 3 etc Put in B2: =IF(A2<>A1,1,"") Copy down Kill the formulas in col B with an in-place: Copy > Paste spe...

finding hidden tab settings
I appear to have some hidden tab settings from text that I have imported from WordPerfect. How do I find and delete them? I am accustomed to using "Reveal Codes" and am totally lost. I did save the text as text only, but it appears that the tabs came over with the text. ...

Multiple Journal Entries
Frequently one of our users gets multiple listings in Journal from a single event. It doesn't seem to be related to the event and can be listed up to 11 times (the record). He is running Outlook 2003 on an XP sp1 Stinkpad. Our network is Novell/MS with Exchange 2000. We've tried updating client, re-installing Outlook, uninstalling ActiveSync, uninstalling Palm Desktop and hotsync, and several other time-consuming non-solutions. Any ideas? One more thing, he synchronizes all folders upon disconnection each evening. Thanks, Goatscape ...

Rights to Run LoadSim
LoadSim 2003 very clearly warns that you cannot run it unless you're a domain administrator, because it "needs" to create accounts. I have tried it with my permissions, and I can see that they mean it. Are there any alternative utilities that don't have this restriction? Is there any way to tweak LoadSim 2003 so that you can focus it on, say, one OU in which you have been delegated? Even though this is just a test forest, getting administrator rights on it can be a chore. ...

Find the top value in a list
I have a worksheet created in EXCEL 2003 which i use to record swimmers times in several lists. One examlpe is in cells D109 to 113. In cells D111 to 113 are recent times and D109 to 110 are empty. As I add current times to the top of the list. I want to be able to retrive the current value at the top of the list and show it in D106. D107 & 108 are used for other values. At present I have the following formula in cell D106 =OFFSET(D108,COUNTBLANK(D109:D113)+COUNTA(D109,D113),0). This works well but makes updating the list difficult. Is there a simpler way to achive the same...

Can find POP3 server but not SMTP?
Hi all I am having a problem connecting to an SMTP server with Outlook 2000 in Windows XP, it says that the SMTP server is not found and gives me a dialogue box to try and reenter it. The POP3 server is the same as the SMTP server (different ports), and it finds the POP3 server no problem and downloads mail, but when it goes to send mails, it tells me that it can't find the server (even though it just found it). Also I have tried pinging the server, and no problem there. I checked the ports - 25 for SMTP, 110 for POP3. I also verified the following settings were correct by comparing wi...

how to find nodes at xml file without complete load the xml file
how to find nodes at xml file without complete load the xml file since the file is very big!! joe wrote: > how to find nodes at xml file without complete load the xml file > since the file is very big!! You can read through the XML document with an Xml(Text)Reader, that is forward only pull parsing where your code only pulls in the current node. The documentation is here <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemXmlXmlTextReaderClassTopic.asp> for .NET 1.x and here <http://msdn2.microsoft.com/en-us/library/system.xml.xmlreader(...

How find appointments that *start* 12a.m.?
I'm using Outlook 2003. Is there any way to find all appointments that *begin* at 12 a.m.? Hint, it is *not* this: FIND (button) > Options (pull down) > Advanced > (Appointments and Meetings) > Advanced (tab) > Field (pull down) > Date/time fields > start (...which only give options like yesterday, today, last week, etc. ... but not a specific *time* like 12 a.m.) The reason I need to see these is, I may have some holdover things from several upgrades and and old Palm that may have been "no time" in the Palm, but somehow got tagged as 12 a.m. at so...

clearing items shown by the AutoComplete feature in the Advanced Find Dialog box
Hi all, How can I clear the items shown by the AutoComplete feature in the "search for the word(s)" field in the Advanced Find Dialog box?? Thank You Max I found that info in the MRU 1 value in the registry here: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\Office Finder You can try clearing/deleting that value (of course, the usual cautions apply... export the key first just in case) "max" <a@b.net> wrote in message news:D8ymb.486287$4w.57408106@amsnews03.chello.com... > Hi all, > > How can I clear the items shown by the AutoComplete feat...

Lookup / Array Range / find the value
I have seen similiar examples but not that were not using exact matches to retrieve data. This seems simple and maybe I am over thinking but I have been unable to crack this nut. I have a table where the first tier sales runs between 0 and 20k and awards 1K commission. I want to be able to enter the salse result for various team members and obtain the correct commission amount based on their sales for the period. How should I complete the commission formula for this process? Sales Value Start Sales Value Stop Commission $0 $20,000 $1,000.00 $...

Function to find hyperlink URL
Hi, Is there function to return URL of hyperlink? I don't want to use macros. I'm using Excel 2000 Thanks in advance Nikola Milic >>Is there function to return URL of hyperlink? A worksheet function? Afraid not. -- Jim Rech Excel MVP But you could write your own (a userdefined function). I used ctrl-K (insert|Hyperlink) to create the link: Option Explicit Function GetURL(Rng As Range) As String Application.Volatile Set Rng = Rng(1) If Rng.Hyperlinks.Count = 0 Then GetURL = "" Else GetURL = Rng.Hyperlinks(1).Address ...

How to find the right MLM business online that succeeds for you #5
U can 2 Hi there, Building a MLM business can have it's advantages * Lifetime Residual income * Financial Security * Spend more time with your kids * Travel * Get out of debt * Drive a new car * Purchase a vacation home * Pay off your mortgage But to be successful, you must choose the right company. * Choose a company that is at least 3 years old. * Choose a company that has a product or service everybody can use. * Choose a company with a easy to understand compensation plan. * Choose a company that has a low monthly fee, where most everybody can join. * Choose a company that ...

Finding cell text corresponding to the MAXimum figure in a spreadsheet?
Please can anyone help me with this... :) I've made a spreadsheet with the following attributes: Cells A1 to A100 contain a figure from 1-100 (a 'desirability' rating), sorted so that the highest figures are at the top of the spreadsheet and descend to the lowest figure in cell A100. Cells B1 to B100 contain the title of a CD album. Cells C1 to C100 contain the price of a CD album. I would like to make a formula that searches for the row that produces the highest result given from multiplying the figure in column A with the corresponding figure in column C and returns the co...