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
1753 Views

Similar Articles

[PageSpeed] 53

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:

Debra Dalgleish-help with worksheet data entry
Hi Debra, I browsed your website and found this new data entry worksheet(http://contextures.com/xlForm02.html) which was very good and i showed my boss.He liked the idea of it and thus asked me to work on it.I managed to add a few more fields and it worked fine. I have a cell named "Documentation to support requirement" at B11 and its corresponding text box at D11.My problem now is that at D11, i need two kind of controls one is drop down list box for document type and another control is text box for document name.How do i achieve this? i need both of this control's answer to b...

Rights
All of a sudden anyone who is a member of the doamin admins group can connect to any mailbox. It use to be they had to granted rights to the mailbox. I believ this was done when some rights were adjusted to allow a softwrae progrma to work correctly. What rights would allow this scenario. On Fri, 29 Sep 2006 09:30:02 -0700, George Schneider <georgedschneider@news.postalias> wrote: >All of a sudden anyone who is a member of the doamin admins group can connect >to any mailbox. It use to be they had to granted rights to the mailbox. I >believ this was done when some rig...

formula for displaying only the last entry of a group of cells
How do you write the formula that will display only the latest entry in a succession of entries? For example, if I have 12 months in 12 columns, and the 13th column specifies "Last Update" , if I have made entries for Jan, Feb, Mar so far, I need only the latest and last entry to appear in the 13th column. When I enter April, then it would display in the 13th column cell and so on. Please help. -- Thank you Hi, This returns the rightmost entry in the row A2:M2 =LOOKUP(2,1/(A2:M2<>""),A2:M2) -- Mike When competing hypotheses are otherwise...

left/right or center ?
I have days off in the P column in this format: Sat/Sun I'm using them in another column in this format SatSun, so I'm using this formula: =LEFT(P21,3)&RIGHT(P21,3), which produces SatSun However, I have some days off that just have Sun, which produces SunSun. How can the formula be writen to produce SatSun when two days are showing, and only Sun when one day is showing ? Thanks, Steve Use Substitute, as in: =Substitute(P21,"/","") Regards, Fred "Steve" <Steve@discussions.microsoft.com> wrote in message news:D1729A01-06...

Transaction Entry in AP Multiple Distributions
When setting up a vendor who has multiple distributions for an invoice, the system should deduct the amount from the default account line's amount as new Purch distribution amounts are entered, to keep the invoice distributions in balance. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree&quo...

Windows can't find the ile
Office Home 2007 was working fine almost for a year. Today I clicked on one of my Word files and got a message: "Window can't find the file". Similar thing with other Word and Excel files. Uninstalled and reinstalled Office Home without any affect. Please, help. -- leo See the article "How to re-register Word when problems crop up opening files” at: http://www.word.mvps.org/FAQs/AppErrors/ReRegisterWord.htm -- Hope this helps, Doug Robbins - Word MVP Please reply only to the newsgroups unless you wish to obtain my services on a paid professiona...

Find Average using Sumproduct
Is there a way to find average based on multiple conditions. I've been using Sumproduct formula to Sum all the cells but not sure how to use it find average. =SUMPRODUCT(--($B$4:$AT$4=$C$113),--($B$5:$AT$5=$C$115),$B7:$AT7) Thanks for your help in advance... -- Karthi Try this array formula** : =AVERAGE(IF($B$4:$AT$4=$C$113,IF($B$5:$AT$5=$C$115,$B7:$AT7))) ** array formulas need to be entered using the key combination of CTRL,SHIFT,ENTER (not just ENTER). Hold down both the CTRL key and the SHIFT key then hit ENTER. -- Biff Microsoft Excel MVP "Karth...

Find Value; Return Row number
Goodmorning everybody! I was wondering if someone could help me with the following problem: "I wanted to make a macro which would find the first value (counting from a1) that matches the value stated in C14 of "FORM". When it gives a match I want to return the row number to "Sheet2". I tested it with dates of which I was certain it had to find a match (as I entered them myself in "Sheet1") Still it returns: "Named Argument not Found" (Runtime error 448)" I hope someon sees my mistake(s). Thanks in Advance!! Sub TestDelete() l = Sheet...

Find and Replace #7
Hi, need help with finding and replacing data. I found this macro on another site Sub myReplace() Columns("A:C").Replace What:=Range("E1").Value Replacement:=Range("E2").Value, LookAt:=xlWhole, SearchOrder:=xlByRows MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False End Sub Was wondering if anyone could adapt it for my needs. Tried to modify i myself but don't know anything about VBA. The data that I want to replace is in a range called "data" (A2:H500 on sheet "datainput" Replace what ("C5") on "search" sh...

form entry based on combo box/lookup
ok. I have been marauding these forums for awhile now and first of thanks to all those whom help others out... makes a difference. This is my first post in here and hopefully this will make sense... I have three tables. one for clients one for employees and one for hourly charges this database is going to end up being remotely accessed > still working on that part as well... but here is my current hurdle... I have a form that outputs to the hourly charges table but pulls information from clients for the "PROPERTYNAME" and "COSTPERONSITE". and from employees for...

find and replace in imported picture
Hello, I am trying to replace all decimal points by a comma in an imported picture in powerpoint 2003. Find .([0-9]) and replace ,\1 doesn't work. Any (simple) suggestion please? I'm confused. If it's a picture, you can't replace anything in it. -- Echo [MS PPT MVP] http://www.echosvoice.com What's new in PPT 2010? http://www.echosvoice.com/2010.htm Fixing PowerPoint Annoyances http://tinyurl.com/36grcd PowerPoint 2007 Complete Makeover Kit http://tinyurl.com/32a7nx "JL LEROY" <JL LEROY @discussions.microsoft.com> wrote in message n...

can I find merged cells?
I'm trying to sort and get the message "merged cells must be the same size". How can I 'find' the merged cells? David, here is a macro by Dave Peterson that will do it Sub Found_Merged_Cells() 'macro looks for merged cells 'By Dave Peterson Dim myCell As Range Dim resp As Long For Each myCell In ActiveSheet.UsedRange.Cells If myCell.MergeCells Then If myCell.Address = myCell.MergeArea(1).Address Then resp = MsgBox(prompt:="found: " _ & myCell.MergeArea.Addre...

find string and return true
hi, i am trying to figure out a worksheet function, which would look for particular string, say "hi", in a cell which would have a sentence, sa "hi my name is joe doe", and return true. find and search would retur the positions. basically, my requirement is to look for a particular string in colum A and return "true" in column B if the string exists. please help. thanks, mac -- icestationzbr ----------------------------------------------------------------------- icestationzbra's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=4...

Finding a Central Location
I have a Table that has over 107,000 records in it. It includes origin city and state and destination city and state. I am trying to figure out where the best place to put a new warehouse or warehouses would be using all of this shipping data. Is there any way that I can do that using Access 2000? If I could put all of the locations on a map of some kind that might be useful as well. Thanks for any help you can give me and Happy Holidays! ...

Subquery to find consecutive dates
Howdy Folks, I have a table that contains a series of asbestos sampling dates at several different locations. A simplified version of the structure is as shown below: [Location] [Sampler] - Company that performed the sampling [Sample Date] [Result] - Numerical Result [Detection Flag] - Yes or No When the detection flag is "Y" for a given day, I want to know if the next day also has a detection. If not, I want to ignore that detection. If yes, I want the first day to get flagged with a "1" and the subsequent day to be flagged with a "2". This gets trickier when ...

T-SQL query for finding shared user and team records
Hi all, I'm new to CRM and would appreciate any help. I need to find account records that record owners have shared to users or teams in CRM. I've found out that this requires direct query to filtered view tables. Microsoft responded as below by I need actual T-SQL query. Can anyone help with this? You would need to write a query against the PrincipalObjectAccess table and you would need to have joins to the other related tables. If you tried to have it all displayed using one query, it would be a pretty complex query. This is because you would need to join to the FilteredA...

Change default font for new entries
I have a large spreadsheet that has a lot of different data (obviously). Additions need to be made. Is there any way to change the font for all new entries, besides cell by cell highlighting? Please help. Thank you. Select all the cells that will contain new data and format all at one go. Gord Dibben MS Excel MVP On Thu, 27 May 2010 13:59:37 -0700, Terry <Terry@discussions.microsoft.com> wrote: >I have a large spreadsheet that has a lot of different data (obviously). >Additions need to be made. Is there any way to change the font for all new >entries,...

Number of entries in drop down box
I have a drop down box in my spreadsheet that I use for listing the builders that I work with/for. It appears that the max. number of entries is 12. Can I increase that? -- theslaz ------------------------------------------------------------------------ theslaz's Profile: http://www.thecodecage.com/forumz/member.php?userid=44 View this thread: http://www.thecodecage.com/forumz/showthread.php?t=35320 Is it a validation dropdown or a worksheet dropdown or a combobox? -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) --------------------------...

How do you find out who received your out of office message?
I'm trying to see if there's anyway to find "sent" out of office responses/messages, and who received them and when. users would have no record, other than messages that arrived while it was enabled, but the administrator could look in the exchange logs. -- -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by email: mailto:dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlook and Exchange: mailto:EMO-NEWSLETTER-S...

Remove link fr a column of entries #2
I know how to remove a link from a single cell. Right click, hyperlink, remove hyperlink. I have a column of cells and it is very cumbersome to remove cell by cell. Is there any way to remove all cells in one action.? TIA, Rasoul Khoshravan Rasoul Can you select the entire column and just delete that. Click on the column column header and press Ctrl + - to delete the whole column. Else, Select the links, right click, choose delete, Cells up. Regards Peter "Rasoul Khoshravan Azar" wrote: > I know how to remove a link from a single cell. Right click, hyperlink, > remove hy...

No hypervisor boot entry resumes with hypervisor started
I have created a "no hypervisor" boot entry following the PC Guy's blog entry here http://blogs.msdn.com/virtual_pc_guy/archive/2008/04/14/creating-a-no-hypervisor-boot-entry.aspx The problem is that even if I initially boot into "no hypervisor", once the OS sleeps, it always resumes using the original boot entry with hypervisor started. Anyone knows how to make the OS resume with the initial "no hypervisor" boot entry? Hello PeterG, I suggest you use the Hyper-V forum instead: http://social.technet.microsoft.com/Forums/en/winserverhyperv/th...

Can't find spellcheck
Good morning. I purchased a Compaq laptop and can not find spell check for email. Any advice? Thanks, Stan -- Stan Lubin, CPA Cell: 434-409-7990 Home: 434-975-1680 Fax: 434-296-6288 This is the wrong place to ask that question, this is the MS Access board. You also might want to include what software you're using, is it outlook? If so, you only need to go to tools->spelling and grammar while composing a new mail. "Stan Lubin" wrote: > Good morning. I purchased a Compaq laptop and can not find spell check for > email. Any advice? &g...

How can the Start time for a Journal Entry be "none".
I'm using outlook 2003 and win2k. Every time I make a journal entry the start time and end time display as none, but only in the entry list. If I open an item, or even if I export the items to .csv, the fields are correct, but in the entry list the start and end columns have the value "none", and therefore none of the views work. I've done "detect and repair". I've done outlook /cleanviews and outlook /cleanprofile. Nothing makes the start and end columns in the list of journal entries show the correct values! I feel like this would be going to ridiculous ...

How to find set of numbers to sum nearest to a given total but not more?
How to find a set of numbers to sum the nearest by defect to a given total but not more? I have a set of numbers (invoice amounts) with decimals and want to find a set of numbers to sum the nearest by defect to a given total but not more. How to do it? For instance, if I had the numbers 1, 3, and 10, and I wanted the set to sum a total of 13 (or nearest one, not more), I would choose 3 & 10. If I wanted a total of 14, I would choose them all, and if I wanted, say, 9, I would choose 1 & 4 as the nearest one (not 10, since 10 is more than the total 9). Thanks! ...

Find & Replace #3
I need to find empty cells and replace with 0. I thought I used to use "" to determine an empty cell or maybe I've just gone brain dead. Thanks Hi Nolan! Select the range Edit > GoTo > Special Check Blanks OK Type 0 then use Ctrl + Enter But this will only cover cells that are blanks and will not affect cells where formulas resolve to "". -- Regards Norman Harker MVP (Excel) Sydney, Australia njharker@optusnet.com.au Excel and Word Function Lists (Classifications, Syntax and Arguments) available free to good homes. Did you really type in the double quote...