473,804 Members | 3,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

parseing an xml string

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="u rn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSe t" msdata:IsDataSe t="true">
<xs:complexType >
<xs:choice minOccurs="0" maxOccurs="unbo unded">
<xs:element name="Table">
<xs:complexType >
<xs:sequence>
<xs:element name="CustomerS hortName">
<xs:simpleTyp e>
<xs:restricti on base="xs:string ">
<xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CreateDat e" type="xs:dateTi me" />
.... 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, CustomerShortNa me and CreateDate

they are defined as
<xs:element name="CustomerS hortName">
<xs:simpleTyp e>
<xs:restricti on base="xs:string ">
<xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>

and

<xs:element name="CreateDat e" type="xs:dateTi me" />
I need to step through the entire xml document and retrieve out
CustomerShortNa me, string, 10
and
CreateDate, dateTime

can someone show me how to parse this?
Nov 16 '05 #1
4 1444
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" <kh********@pro jectresources.n ospam.com> wrote in message
news:uQ******** ******@TK2MSFTN GP15.phx.gbl...
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="u rn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSe t" msdata:IsDataSe t="true">
<xs:complexType >
<xs:choice minOccurs="0" maxOccurs="unbo unded">
<xs:element name="Table">
<xs:complexType >
<xs:sequence>
<xs:element name="CustomerS hortName">
<xs:simpleTyp e>
<xs:restricti on base="xs:string ">
<xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CreateDat e" type="xs:dateTi me" />
.... 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, CustomerShortNa me and CreateDate

they are defined as
<xs:element name="CustomerS hortName">
<xs:simpleTyp e>
<xs:restricti on base="xs:string ">
<xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>

and

<xs:element name="CreateDat e" type="xs:dateTi me" />
I need to step through the entire xml document and retrieve out
CustomerShortNa me, string, 10
and
CreateDate, dateTime

can someone show me how to parse this?

Nov 16 '05 #2
In article <uQ************ **@TK2MSFTNGP15 .phx.gbl>, Keith Henderson wrote:
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="u rn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSe t" msdata:IsDataSe t="true">
<xs:complexType >
<xs:choice minOccurs="0" maxOccurs="unbo unded">
<xs:element name="Table">
<xs:complexType >
<xs:sequence>
<xs:element name="CustomerS hortName">
<xs:simpleTyp e>
<xs:restricti on base="xs:string ">
<xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="CreateDat e" type="xs:dateTi me" />
.... 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, CustomerShortNa me and CreateDate

they are defined as
<xs:element name="CustomerS hortName">
<xs:simpleTyp e>
<xs:restricti on base="xs:string ">
<xs:maxLength value="10" />
</xs:restriction>
</xs:simpleType>
</xs:element>

and

<xs:element name="CreateDat e" type="xs:dateTi me" />
I need to step through the entire xml document and retrieve out
CustomerShortNa me, string, 10
and
CreateDate, dateTime

can someone show me how to parse this?


You'll probably want to look at the documentation and example for
System.Xml.XmlT extReader....
--
Tom Shelton [MVP]
Nov 16 '05 #3
In article <uw************ *@TK2MSFTNGP11. phx.gbl>, CJ Taylor wrote:
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


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]
Nov 16 '05 #4
Keith,

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

http://groups.google.com/groups?selm...phx.gbl&rnum=1

I hope this helps?

Cor
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
6756
by: Krakatioison | last post by:
My sites navigation is like this: http://www.newsbackup.com/index.php?n=000000000040900000 , depending on the variable "n" (which is always a number), it will take me anywhere on the site... this number is always changing as I have hundreds of thousand of pages of text on my site. Problem: - in my opinion this just not only look weird, but the variable "n" (number)
5
31183
by: Stu Cazzo | last post by:
I have the following: String myStringArray; String myString = "98 99 100"; I want to split up myString and put it into myStringArray. If I use this: myStringArray = myString.split(" "); it will split myString up using the delimiter of 1 space so that
9
8005
by: John F Dutcher | last post by:
I use code like the following to retrieve fields from a form: recd = recd.append(string.ljust(form.getfirst("lname",' '),15)) recd.append(string.ljust(form.getfirst("fname",' '),15)) etc., etc. The intent is to finish by assigning the list to a string that I would write to disk: recstr = string.join(recd,'')
9
3700
by: Derek Hart | last post by:
I wish to execute code from a string. The string will have a function name, which will return a string: Dim a as string a = "MyFunctionName(param1, param2)" I have seen a ton of people discuss how reflection does this, but I cannot find the syntax to do this. I have tried several code example off of gotdotnet and other articles. Can somebody please show me the code to do this?
10
8193
by: Angus Leeming | last post by:
Hello, Could someone explain to me why the Standard conveners chose to typedef std::string rather than derive it from std::basic_string<char, ...>? The result of course is that it is effectively impossible to forward declare std::string. (Yes I am aware that some libraries have a string_fwd.h header, but this is not portable.) That said, is there any real reason why I can't derive an otherwise empty
2
1817
by: Fred | last post by:
Hi, I am parsing a small xml document and the parseing goes 'all funny' when parsing this element: <useragent>Mozilla/4.61 (WinNT; I)</useragent> I've created a subclass of org.xml.sax.helpers.DefaultHandler, and an instance of this subclass is set on my org.apache.xerces.parsers.SAXParser:
2
1360
by: An S. | last post by:
I have created a little "update" system, that tells when a update from nvidia is released, currently it tells it from a "simple" protocol "S2P", i have been told that XML, is much easier, for the client to download, and then read it afterwards, sooo does anyone know a good XML parseing libary? thanks FreeGeG
6
1232
by: Brian Henry | last post by:
How would you parse this type of file into an array? "Test","Help, data","hello there, this text has commas","commas seperate data, and in quotes they dont" where the double quotes are the string markers, which can contain comma's, but when you are not in a quote block the commas seperate the data... you're basic Comma seperated value file... thanks (i know split doesnt work for this... thats why im asking)
4
1030
by: Keith Henderson | last post by:
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">
0
9572
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10303
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10070
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.