.NETGURU
parseing an xml string
Messages   Related Types
This message was discovered on microsoft.public.dotnet.languages.vb.

Post a new message to this list...

Keith Henderson
I have an xml document loaded into a string that I need to parse. below is
the first few elements in the xml string.

<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema";
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="CustomerShortName">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CreateDate" type="xs:dateTime" />
.... there is more I didn't show......

I need to step through it and if you look closely you see 2 keys
identifying column names, CustomerShortName and CreateDate

they are defined as
<xs:element name="CustomerShortName">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>

and

<xs:element name="CreateDate" type="xs:dateTime" />

I need to step through the entire xml document and retrieve out
CustomerShortName, string, 10
and
CreateDate, dateTime

can someone show me how to parse this?

Reply to this message...
 
    
Tom Shelton
In article <Click here to reveal e-mail address>, Keith Henderson wrote:
[Original message clipped]

You'll probably want to look at the documentation and example for
System.Xml.XmlTextReader....

--
Tom Shelton [MVP]
Reply to this message...
 
    
Cor Ligthert
Keith,

I would use the XMLnodereader, see this sample I have made for somebody
else.

http://groups.google.com/groups?selm=%239UdmXBkEHA.3848%40tk2msftngp13.phx.gbl&rnum=1

I hope this helps?

Cor

Reply to this message...
 
    
CJ Taylor
If you need to "step through" XML you should use an SAX Parser. DOM Parsers
read in the entire document and then allow you to parse, SAX will actually
raise events for elements being read/parsed.

There is a free SAX Parser that comes with the Visual Basic Resource Kit I
believe.

-CJ

"Keith Henderson" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
> I have an xml document loaded into a string that I need to parse. below
is
[Original message clipped]

Reply to this message...
 
    
Tom Shelton
In article <Click here to reveal e-mail address>, CJ Taylor wrote:
[Original message clipped]

I think that XmlTextReader meets these requirements...

from the docs:

XmlTextReader Class
Represents a reader that provides fast, NON-CACHED, forward-only access
to XML data.

I don't think he really needs the resource kit....
--
Tom Shelton [MVP]
Reply to this message...
 
 
System.Xml.XmlTextReader




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification