Search:
Namespaces
Discussions
.NET v1.1
Feedback
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
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com