473,836 Members | 2,174 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 21 '05 #1
4 1030
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 21 '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 21 '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 21 '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 21 '05 #5

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

Similar topics

16
6769
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
31187
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
8008
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
3702
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
8202
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
1818
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:
37
4726
by: Kevin C | last post by:
Quick Question: StringBuilder is obviously more efficient dealing with string concatenations than the old '+=' method... however, in dealing with relatively large string concatenations (ie, 20-30k), what are the performance differences (if any with something as trivial as this) between initializing a new instance of StringBuilder with a specified capacity vs. initializing a new instance without... (the final length is not fixed) ie,
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
4
1445
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">
6
1233
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)
0
9656
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
10819
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10570
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
10240
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...
1
7772
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
6972
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5641
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...
0
5811
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4000
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.