473,791 Members | 2,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to parse individual fields/elements within XML string from Cli

I am using Microsoft Developer Environment 2003 Version 7.1.3088 and .NET
Framework version 1.1.4322 SP1.

From my web-service I get one row of data and return it to my client. From
my client I want to be able to parse apart the Data in the returned XML
string by field name. (<group_name>, <city>, <state?, etc.) Thank-you.

More details follow:

(The Data set is sent to the client from the web-service with .GetXML, see
below in SECTION 1.)

When I test my web-service, I see my data as I expect with XML wrapped
around each data item. See SECTION 2 below. From my client side, when I
load the data into a label to display the data, I see the data only without
the XML code, but I think that is because the list box is handling the XML
and just displaying the data. (If I write a script to display each character
in my lblMessage.text , I do see all the XML stuff around my data.) See
SECTION 3 below for how it looks in the label. All I want to be able to do
in my client application is parse apart the Data by name. (i.e. access the
<email_addres s> element and get the result and see the result
Te*******@Anywh ere.com or access the <group_name> element and get the result.
It seems like I should somehow be able to just access the XML and say I
want this element of the data, but I can’t find the syntax anywhere.

I’ve gone through examples on Microsoft.com, some tutorials and books, but
they all seem to either not work, or only return one item in the list, which
is too simplistic. Can someone point me in the correct direction? Thank-you.

SECTION 1. - Web Method to Get data and return it

<WebMethod()> _
Public Function srDAL_GetBroker DataByGroup(ByV al groupId As String) As
String

groupId = groupId.Trim

OleDbConnection Reporting_PROD. Open()
OleDbCommandRep orting_PROD.Com mandText = "Select * from
srDAL_Brokers where group_id = '" + groupId + "'"
OleDbDataAdapte rReporting_PROD .SelectCommand =
OleDbCommandRep orting_PROD
OleDbDataAdapte rReporting_PROD .Fill(DataSet_s rDAL_Brokers,
"srDAL_Brokers" )
OleDbConnection Reporting_PROD. Close()
Return DataSet_srDAL_B rokers.GetXml

End Function

SECTION 2 – What I see when testing the service in The web-service application

<?xml version="1.0" encoding="utf-8" ?>
<string
xmlns="http://tempuri.org/DDPWAsalesRepor tingDAL/ServiceSalesRep ortingDAL"><Dat aSet_srDAL_Brok ers
xmlns="http://www.tempuri.org/DataSet1.xsd"> <srDAL_Broker s>
<group_gid>32 </group_gid> <group_number>1 40</group_number>
<sublocation_nu mber>0</sublocation_num ber> <group_name>M Y TEST
GROUP</group_name> <contact_gid>10 0</contact_gid>
<demographic_gi d>200</demographic_gid >
<effective_date >2004-07-01T00:00:00.000 0000-07:00</effective_date>
<termination_da te>9999-12-31T00:00:00.000 0000-08:00</termination_dat e>
<email_address> Te*******@anywh ere.com</email_address>
<phone_number>9 995551212</phone_number> <extension> </extension>
<other_phone_nu mber>0000000000 </other_phone_num ber>
<fax_number>999 5551212</fax_number> <salutation_nam e> </salutation_name >
<name_prefix> </name_prefix> <first_name>JOH N</first_name>
<last_name>SMIT H</last_name> <middle_name> </middle_name> <name_suffix>
</name_suffix> <actual_ssn>000 000000</actual_ssn> <gender>M</gender>
<hipaa_id> </hipaa_id> <business_name> TEST BUSINESS</business_name>
<address_1>1234 5 MAIN STREET</address_1> <address_2>SUIT E A</address_2>
<city>ANY CITY USA</city> <state>XX</state> <zip_code>999 99-1234</zip_code>
<country>USA </country> <group_id>00140 </group_id> </srDAL_Brokers>
</DataSet_srDAL_B rokers></string>

SECTION 3 – What I see from my client side when I call the service and put
the data in a label. This is how the data looks in lblMessage.text

32 140 0 MY TEST GROUP 100 200 2004-07-01T00:00:00.000 0000-07:00
9999-12-31T00:00:00.000 0000-08:00 Te*******@anywh ere.com 9995551212
0000000000 9995551212 JOHN SMITH 000000000 M TEST BUSINESS 12345 MAIN STREET
SUITE A ANY CITY USA XX 99999-1234 USA 00140

SECTION 4 – The code on the client side.

Private Sub btnGetBrokerByG roupId_Click(By Val sender As System.Object,
ByVal e As System.EventArg s) Handles btnGetBrokerByG roupId.Click

Dim groupId As String
Dim x As Integer
Dim y As String
groupId = "00140"
Dim GB As New
SalesReportingD ALgetBrokerByGr oupId.ServiceSa lesReportingDAL
lblMessage.Text = GB.srDAL_GetBro kerDataByGroup( groupId)
End Sub
Nov 23 '05 #1
0 1374

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

Similar topics

6
7753
by: chuck amadi | last post by:
Hi , Im trying to parse a specific users mailbox (testwwws) and output the body of the messages to a file ,that file will then be loaded into a PostGresql DB at some point . I have read the email posts and been advised to use the email Module and mailbox Module. The blurb from a memeber of this list . Im not at work at the moment So I cant test this out , but if someone could take a look and check that im on the write track as this...
21
2674
by: William Stacey [MVP] | last post by:
Anyone know of some library that will parse files like following: options { directory "/etc"; allow-query { any; }; // This is the default recursion no; listen-on { 192.168.0.225; }; forwarders { 4.2.2.2; }; };
0
313
by: KarenS | last post by:
I am using Microsoft Developer Environment 2003 Version 7.1.3088 and .NET Framework version 1.1.4322 SP1. From my web-service I get one row of data and return it to my client. From my client I want to be able to parse apart the Data in the returned XML string by field name. (<group_name>, <city>, <state?, etc.) Thank-you. More details follow: (The Data set is sent to the client from the web-service with .GetXML, see
9
5740
by: RMC | last post by:
Hello, I'm looking for a way to parse/format a memo field within a report. The Access 2000 database (application) has an equipment table that holds a memo field. Within the report, the memo field is printed within the detailed area. The problem is, the apllication is not setup properly, thus the users are entering data within the memo field as: location1 1/1/2005 1/1/2006
29
2909
by: gs | last post by:
let say I have to deal with various date format and I am give format string from one of the following dd/mm/yyyy mm/dd/yyyy dd/mmm/yyyy mmm/dd/yyyy dd/mm/yy mm/dd/yy dd/mmm/yy mmm/dd/yy
5
7145
by: phpCodeHead | last post by:
I am needing to determine how to go about validating that a field in my form contains only a positive integer. I know that this is fairly simple if the form contains only one element to be validated; but, a much bigger challenge ( to me anyway, that's why I'm coming to the pros! ) when I don't know exactly how many fields may appear on the form as it is dynamically generated based upon the number of line items to be received on a purchase...
6
2977
by: =?Utf-8?B?RGF2aWRN?= | last post by:
Hello, I have an XML file generated from a third party application that I would like to parse. Ideally, I plan on having a windows service setup to scan various folders for XML files and parse the file, then spit out totals. Since I haven't worked with XML too much in C#, I'm trying to develop a structured and easy-to-read way to parse the file. Essentially, I would like to read the file and add the "BatchTktAmountfor any...
7
1622
by: john.ford | last post by:
I want to take a long alpha-numeric string with \n and white-space and place ALL elements of the string (even individual parts of a long white-space) into separate list elements. The most common way I've seen this performed is with the split() function, however I don't believe that it has the power to do what I am looking for. Any suggestions? thanks
1
4169
by: (2b|!2b)==? | last post by:
I am expecting a string of this format: "id1:param1,param2;id2:param1,param2,param3;id" The tokens are seperated by semicolon ";" However each token is really a struct of the following format: struct mst_ {
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9515
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
10207
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...
0
9993
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
9029
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...
0
6776
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
5430
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
4109
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
3
2913
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.