How to read the information from the XML stream?

  • Thread starter Thread starter Marko Vuksanovic
  • Start date Start date
M

Marko Vuksanovic

I have the following string:

<photo id="218644972" owner="81716338@N00" secret="e7e02342ba" server="60" title="Phil in Riverside (6)" ispublic="1" isfriend="0" isfamily="0" />

How can I get the id, owner, secret, server and so on to a variable, or a dataTable/dataSet?

Thanks in advance,
Marko Vuksanovic.
 
Well, the problem is that the text displayed here is a part of a valid xml document. This is only a part of it and I need to get the attributes in a DataTable/DataSet.
so what is the problem?

as far as i know, if the data is read from the file there has to be some xml header in the file called DOCTYPE in order not get an error from .Net; the heade should look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rootElement[]>

I have the following string:

<photo id="218644972" owner="81716338@N00" secret="e7e02342ba" server="60" title="Phil in Riverside (6)" ispublic="1" isfriend="0" isfamily="0" />

How can I get the id, owner, secret, server and so on to a variable, or a dataTable/dataSet?

Thanks in advance,
Marko Vuksanovic.
 
string str = "<photo id=\"218644972\" owner=\"81716338@N00\" secret=\"e7e02342ba\" server=\"60\" title=\"Phil in Riverside (6)\" ispublic=\"1\" isfriend=\"0\" isfamily=\"0\" />";
StringReader sreader = new StringReader(str);
DataSet ds = new DataSet();
ds.ReadXml(sreader);

Mike
http://www.seeknsnatch.com
I have the following string:

<photo id="218644972" owner="81716338@N00" secret="e7e02342ba" server="60" title="Phil in Riverside (6)" ispublic="1" isfriend="0" isfamily="0" />

How can I get the id, owner, secret, server and so on to a variable, or a dataTable/dataSet?

Thanks in advance,
Marko Vuksanovic.
 
so what is the problem?

as far as i know, if the data is read from the file there has to be some xml header in the file called DOCTYPE in order not get an error from .Net; the heade should look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rootElement[]>

I have the following string:

<photo id="218644972" owner="81716338@N00" secret="e7e02342ba" server="60" title="Phil in Riverside (6)" ispublic="1" isfriend="0" isfamily="0" />

How can I get the id, owner, secret, server and so on to a variable, or a dataTable/dataSet?

Thanks in advance,
Marko Vuksanovic.
 
Back
Top