Home All Groups Group Topic Archive Search About

How to read the information from the XML stream?

Author
18 Aug 2006 7:44 PM
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.

Author
18 Aug 2006 10:57 PM
Michael
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
  "Marko Vuksanovic" <markovuksano***@hotmail.com> wrote in message news:B649571E-53CD-4810-AFEF-A3471B6A1831@microsoft.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.
Author
19 Aug 2006 8:40 PM
Leon_Amirreza
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[]>

  "Marko Vuksanovic" <markovuksano***@hotmail.com> wrote in message news:B649571E-53CD-4810-AFEF-A3471B6A1831@microsoft.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.
Author
18 Aug 2006 9:46 PM
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.
  "Leon_Amirreza" <amirreza_rahm***@yahoo.com> wrote in message news:e$vOE7wwGHA.1224@TK2MSFTNGP03.phx.gbl...
  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[]>

    "Marko Vuksanovic" <markovuksano***@hotmail.com> wrote in message news:B649571E-53CD-4810-AFEF-A3471B6A1831@microsoft.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.

AddThis Social Bookmark Button