"Well-formed XML"

B

Bryan Dickerson

Still considering myself a newbie to the world of XML, etc., 'cause my
program is still not working (not that I'll be an expert when it does,
but...). When I try to apply XPath statements to the XML string to pull
nodes, etc. out of it, I'm getting nothing back. Could my problem be that
the XML that is returned from my Web service does not have the standard "
<?xml version="1.0" ?>" (or whatever it is) header on it?

Here's my code:

------------------------------------------------------
Dim oC As New localhost.Service1
Dim oXML As New XmlDocument
Dim oNL As XmlNodeList
Dim oNd As XmlNode

Try
oXML.LoadXml(oC.GetAllContacts(txCICust.Text, txCIType.Text))
oNL = oXML.DocumentElement.SelectNodes("NewDataSet/Table/CI_NAME")
txResults.Text = "Found " & oNL.Count & " Contact records: "
For Each oNd In oNL
txResults.AppendText(vbCrLf & oNd.Value)
Next
txResults.AppendText(vbCrLf & "Done.")
Catch ex As Exception
MessageBox.Show("Error occurred: " & ex.Message)
End Try
 
C

Cor Ligthert

Bryan,

Why do you try to read a dataset as a document.

In my opinion would just a dataset do the job.

Something as
dim ds as dataset = localhost.service1 (where (web)service1 returns a
dataset)

dim myfield is ds.tables(0).rows(0).item(0) to get the first item in the
first row in the first datatable.

I hope this helps.

Cor
 
B

Bryan Dickerson

Because this Web service will eventually feed a 3rd-party app (or two) that
will accept XML. Also I have a pilot project to learn all this, so I'm
trying to find the easiest way to read the XML that is returned. My boss
wants the Web service to return XML.
 
C

Cor Ligthert

Bryan,

I saw the word Dataset in the XML I have the assumption therefore that the
file that is returned is a XML dataset.

XML says only that the file uses tags, which are suported by a schema.

In VBNet there are classes to handle a dataset. In DHTML I use for that the
loaddoc.

However if your boss says to use square wheels to handle a dataset, than do
it. Mostly in this kind of situations your boss will tell at the end that
you did not understand him.

However, just my thought,

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top