I have returned xml data in a variable and need to loop through the returned xml and pull certain data from select nodes.
I was thinking the best way would be to load into a dataset (or datatable) and loop through that.
I also have the xmlschema. What's the best way to code this?
I thought I could do something like so but it gives me the following error:
DataTable 'newdt' does not match to any DataTable in source.
SearchResults.xsdCode:Dim dtResults As New DataTable("newdt") dtResults.ReadXmlSchema("SearchResults.xsd") dtResults.ReadXml(sRetVal)
sample text need to loop throughCode:<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="Resumes"> <xs:complexType> <xs:sequence> <xs:element name="Resume" maxOccurs="1000"> <xs:complexType> <xs:sequence> <xs:element name="id" type="xs:string"/> <xs:element name="City" type="xs:string" minOccurs="0"/> <xs:element name="State" type="xs:string" minOccurs="0"/> <xs:element name="Country" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>
Code:<?xml version="1.0" encoding="utf-8"?> <Resumes xmlns="http://hj.yahooapis.com/v1/schema.rng" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" xml:lang="en-US" yahoo:start="1" yahoo:total="4" yahoo:count="4"> <Resume yahoo:uri="http://hj.yahooapis.com/v1/Resume/MjAxxx" xml:lang="en-US" > <id>MjAxxx</id> <City>Prior Lake</City> <State>MN</State> <Country>USA</Country> </Resume> <Resume yahoo:uri="http://hj.yahooapis.com/v1/Resume/MjExxx" xml:lang="en-US" > <id>MjExxx</id> <City>Eagan</City> <State>MN</State> <Country>USA</Country> </Resume> <Resume yahoo:uri="http://hj.yahooapis.com/v1/Resume/MzExxx" xml:lang="en-US" > <id>MzExxx</id> <City>Burnsville</City> <State>MN</State> <Country>USA</Country> </Resume> <Resume yahoo:uri="http://hj.yahooapis.com/v1/Resume/ODExxx" xml:lang="en-US" > <id>ODExxx</id> <City>Eagan</City> <State>MN</State> <Country>USA</Country> </Resume> </Resumes> <!-- uncompressed/chunked Fri Mar 27 09:57:27 PDT 2009 -->




Reply With Quote