Trying to figure out XPath and I have successfully create an XPathExpression that lets me grab the events, but any nested sub groups seem to be unavailable to the query, I can get all the children on the Events group, but the LocationName field I can not access.
I am trying to figure out how to get the LocationName child into my query
Here is my expression:
Dim nav As XPathNavigator
Dim docNav As XPathDocument
docNav = New XPathDocument(New XmlNodeReader(rssDoc.DocumentElement()))
nav = docNav.CreateNavigator
'Initial XPathNavigator to start at the root.'
nav.MoveToRoot()
'Sort the Xpath query - this might be black magic'
Dim expr As XPathExpression = nav.Compile("/CALENDAR_ENTERPRISE/EVENTS")
expr.AddSort("StartDate", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Text)
Dim theEvents As XPathNodeIterator = nav.Select(expr)
While (theEvents.MoveNext())
Dim iStartDate As XPathNodeIterator = theEvents.Current.SelectChildren("StartDate", "")
Dim iStartTime As XPathNodeIterator = theEvents.Current.SelectChildren("StartTime", "")
End While
Here is my xml:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<CALENDAR_ENTERPRISE Created="8/12/2010 10:44:50 AM">
<EVENT type="group">
<Name type="text">Fridays After Dark Presents: CHAT and FADD's Halloween Dance</Name>
<Description type="text">&#160;Come decked out in your favorite Halloween costume and dance the night away!</Description>
<ContactName type="text" />
<ContactPhone type="text" />
<ContactEmail type="text" />
<Department type="text">SUS</Department>
<Categorization type="text">Undergraduate::Student Life</Categorization>
<PrivateFlag type="text">N</PrivateFlag>
<Highlight type="text">N</Highlight>
<Locations type="group">
<Location type="group">
<LocationName type="text">Griffin's Den</LocationName>
<SetupNotes type="text" />
</Location>
</Locations>
<Resources type="group" />
<County type="text" />
<Country type="text">United States</Country>
<RegistrationEnabled type="text" />
<RegistrationMaxReg type="text" />
<RegistrationDisplaySpaceAvail type="text" />
<RegistrationType type="text" />
<RegistrationTemplate type="text" />
<InternalCustom1 type="text" />
<InternalCustom2 type="text" />
<InternalCustom3 type="text" />
<InternalCustom4 type="text" />
<InformationStatus type="text" />
<InternalComments type="text" />
<ExternalField1 type="text" />
<ExternalField2 type="text" />
<ExternalField3 type="text" />
<ExternalField4 type="text" />
<AllDay type="text">N</AllDay>
<StartDate type="text">10/29/2010</StartDate>
<StartTime type="text">10:00 PM</StartTime>
<EndDate type="text">10/30/2010</EndDate>
<EndTime type="text">1:00 AM</EndTime>
<RecurType type="text">One Time</RecurType>
<RecurDays type="text">1</RecurDays>
<RecurEndDate type="text">10/29/2010</RecurEndDate>
<Address1 type="text" />
<Address2 type="text" />
<City type="text" />
<State type="text" />
<Zipcode type="text" />
<Phone type="text" />
<InternetAddress type="text" />
<ImportSeriesId type="text">232</ImportSeriesId>
<ImportOccurrenceId type="text">511</ImportOccurrenceId>
<CreatedOn type="text">7/9/2010 9:02:30 AM</CreatedOn>
<ModifiedOn type="text">8/9/2010 2:27:00 PM</ModifiedOn>
<AttachmentBinary type="group" />
<ImageBinary type="group" />
<ExternalSeriesId type="text" />
<ExternalOccurrenceId type="text" />
<EventOwnerName type="text">Murphy, Krista</EventOwnerName>
</EVENT>
<EVENT type="group">
<Name type="text">Undergraduate Saturday Visit</Name>
<Description type="text">Prospective students are welcomed to view a short presentation, speak with Admissions Counselors, tour the campus, and meet with representatives from Financial Aid.
++++
<br /><div>More info available here:
<br /><a href="http://www.chc.edu/Visit_and_Information_Sessions"&gt;http://www.chc.edu/Visit_and_Information_Sessions&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /></div></Description>
<ContactName type="text">Undergraduate Admissions</ContactName>
<ContactPhone type="text">215-248-7001</ContactPhone>
<ContactEmail type="text" />
<Department type="text">SUS</Department>
<Categorization type="text">Public Events||Undergraduate::Admissions</Categorization>
<PrivateFlag type="text">N</PrivateFlag>
<Highlight type="text">N</Highlight>
<Locations type="group" />
<Resources type="group" />
<County type="text" />
<Country type="text">United States</Country>
<RegistrationEnabled type="text" />
<RegistrationMaxReg type="text" />
<RegistrationDisplaySpaceAvail type="text" />
<RegistrationType type="text" />
<RegistrationTemplate type="text" />
<InternalCustom1 type="text" />
<InternalCustom2 type="text" />
<InternalCustom3 type="text" />
<InternalCustom4 type="text" />
<InformationStatus type="text" />
<InternalComments type="text" />
<ExternalField1 type="text" />
<ExternalField2 type="text" />
<ExternalField3 type="text" />
<ExternalField4 type="text" />
<AllDay type="text">N</AllDay>
<StartDate type="text">10/30/2010</StartDate>
<StartTime type="text" />
<EndDate type="text">10/30/2010</EndDate>
<EndTime type="text" />
<RecurType type="text">One Time</RecurType>
<RecurDays type="text">1</RecurDays>
<RecurEndDate type="text">10/30/2010</RecurEndDate>
<Address1 type="text" />
<Address2 type="text" />
<City type="text" />
<State type="text" />
<Zipcode type="text" />
<Phone type="text" />
<InternetAddress type="text" />
<ImportSeriesId type="text">255</ImportSeriesId>
<ImportOccurrenceId type="text">559</ImportOccurrenceId>
<CreatedOn type="text">8/4/2010 9:57:25 AM</CreatedOn>
<ModifiedOn type="text">8/4/2010 2:09:25 PM</ModifiedOn>
<AttachmentBinary type="group" />
<ImageBinary type="group" />
<ExternalSeriesId type="text" />
<ExternalOccurrenceId type="text" />
<EventOwnerName type="text">Boccuzzi, Lori</EventOwnerName>
</EVENT>
<EVENT type="group">
<Name type="text">Shriner's Hospital Service</Name>
<Description type="text"><div>Visit the Campus Ministry Office for more information.</div></Description>
<ContactName type="text" />
<ContactPhone type="text" />
<ContactEmail type="text" />
<Department type="text">SUS</Department>
<Categorization type="text">Undergraduate::Student Life</Categorization>
<PrivateFlag type="text">N</PrivateFlag>
<Highlight type="text">N</Highlight>
<Locations type="group">
<Location type="group">
<LocationName type="text">Off-campus</LocationName>
<SetupNotes type="text" />
</Location>
</Locations>
<Resources type="group" />
<County type="text" />
<Country type="text">United States</Country>
<RegistrationEnabled type="text" />
<RegistrationMaxReg type="text" />
<RegistrationDisplaySpaceAvail type="text" />
<RegistrationType type="text" />
<RegistrationTemplate type="text" />
<InternalCustom1 type="text" />
<InternalCustom2 type="text" />
<InternalCustom3 type="text" />
<InternalCustom4 type="text" />
<InformationStatus type="text" />
<InternalComments type="text" />
<ExternalField1 type="text" />
<ExternalField2 type="text" />
<ExternalField3 type="text" />
<ExternalField4 type="text" />
<AllDay type="text">N</AllDay>
<StartDate type="text">10/30/2010</StartDate>
<StartTime type="text">12:30 PM</StartTime>
<EndDate type="text">10/30/2010</EndDate>
<EndTime type="text">3:30 PM</EndTime>
<RecurType type="text">One Time</RecurType>
<RecurDays type="text">1</RecurDays>
<RecurEndDate type="text">10/30/2010</RecurEndDate>
<Address1 type="text" />
<Address2 type="text" />
<City type="text" />
<State type="text" />
<Zipcode type="text" />
<Phone type="text" />
<InternetAddress type="text" />
<ImportSeriesId type="text">293</ImportSeriesId>
<ImportOccurrenceId type="text">643</ImportOccurrenceId>
<CreatedOn type="text">8/12/2010 10:16:07 AM</CreatedOn>
<ModifiedOn type="text">8/12/2010 10:16:07 AM</ModifiedOn>
<AttachmentBinary type="group" />
<ImageBinary type="group" />
<ExternalSeriesId type="text" />
<ExternalOccurrenceId type="text" />
<EventOwnerName type="text">Murphy, Krista</EventOwnerName>
</EVENT>
</CALENDAR_ENTERPRISE>