Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / XML / September 2007

Tip: Looking for answers? Try searching our database.

SelectSingleNode not working... Code provided.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rafael - 25 Sep 2007 16:53 GMT
All,

The xml file below is a response from a Live Meeting service.  I need to
extract the following two fields: mid and audienceInviteText

I am using vbscript to try and retrieve these values but my code tells me
the replynode is required at line 5.  Here is what I have:

set xmlbody = createobject("Msxml2.DOMDocument")
xmlbody.loadXML("c:\MeetingResponse.xml")

Set replynode =
xmlbody.selectSingleNode("//CreateMeetingReply/MeetingReply/OptionList")
Set myAtt = replynode.getAttributes.GetNamedItem("mid")
msgbox myAtt.Value

' File name is C:\MeetingResponse.xml

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<PlaceWareConfCenter>
<CreateMeetingReply>
<MeetingReply>
<OptionList>
<StringOption value="49129v48zw3zw3dk" name="mid"></StringOption>
<StringOption value="Rafael has invited you to attend a Live Meeting.

https://www.livemeeting.com/cc/test/join?id=J6333&amp;role=attend&amp;pw=wn%3F%2
447444


 Subject: Test Meeting
 Meeting URL: https://www.livemeeting.com/cc/test/join
 Meeting ID: J64443
 Meeting Key: wn?&amp;12345
 Role: Attendee
 Audio Conferencing (Toll-free): +1 (800) 123-0000
 Participant Code: 000000

FIRST TIME USERS: To save time before the meeting, check your system to make
sure it is compatible with Microsoft Office Live Meeting:
http://go.microsoft.com/fwlink/?linkid=53334

This Live Meeting invitation is a personal invitation; it should not be
forwarded.

For assistance, visit Live Meeting Help and Support:
http://r.office.microsoft.com/r/rlidLiveMeeting?p1=7&amp;p2=en_US&amp;p3=LMInfo&
amp;p4=support
"
name="audienceInviteText"></StringOption>
</OptionList>
</MeetingReply>
</CreateMeetingReply>
</PlaceWareConfCenter>
Martin Honnen - 25 Sep 2007 17:27 GMT
> The xml file below is a response from a Live Meeting service.  I need to
> extract the following two fields: mid and audienceInviteText
[quoted text clipped - 3 lines]
>
> set xmlbody = createobject("Msxml2.DOMDocument")

This newsgroup is about XML and the .NET framework. If you use the .NET
framework then you should not use MSXML but rather use the classes in
System.Xml, like XmlReader or XPathDocument/XPathNavigator or XmlDocument.

> xmlbody.loadXML("c:\MeetingResponse.xml")

The loadXML method takes a string with XML, not a file name. Use the
load method if you want to load from a URL or file e.g.
  If xmlbody.load("C:\MeetingResponse.xml") Then
    ' parse out values here
  Else
    ' deal with xmlbody.parseError here
  End If

> Set replynode =
> xmlbody.selectSingleNode("//CreateMeetingReply/MeetingReply/OptionList")

Set
  xmlbody.setProperty "SelectionLanguage", "XPath"
firsdt with Msxml2.DOMDocument, then call selectSingleNode or
selectNodes with an XPath expression.

> Set myAtt = replynode.getAttributes.GetNamedItem("mid")
> msgbox myAtt.Value
[quoted text clipped - 29 lines]
> http://r.office.microsoft.com/r/rlidLiveMeeting?p1=7&amp;p2=en_US&amp;p3=LMInfo&
amp;p4=support
"
> name="audienceInviteText"></StringOption>

Use e.g.
  Set optionList =
xmlbody.selectSingleNode("PlaceWareConfCenter/CreateMeetingReply/MeetingReply/OptionList")
  Set midValue = optionList.selectSingleNode("StringOption[@name =
'mid']/@value")
  Set inviteValue = optionList.selectSingleNode("StringOption[@name =
'audienceInviteText']/@value")
  ' now you can access midValue.value and inviteValue.value e.g.
  WScript.Echo midValue.value
  WScript.Echo inviteValue.value

Signature

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/

Rafael - 25 Sep 2007 18:32 GMT
Excellent Martin! Exactly what I was looking for.

Thanks,

Rafael

>> The xml file below is a response from a Live Meeting service.  I need to
>> extract the following two fields: mid and audienceInviteText
[quoted text clipped - 69 lines]
>   WScript.Echo midValue.value
>   WScript.Echo inviteValue.value

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.