EDN Admin
Well-known member
Hello All gurus,
I have a simple xml read question. I attached my code here.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; public DataSet getSpecificXmlData(<span style="color:Blue; string strFilePath, <span style="color:Blue; string strBusinessNo)
{
XmlDataDocument docData = <span style="color:Blue; new XmlDataDocument();
DataSet ds = <span style="color:Blue; new DataSet();
<span style="color:Blue; using (XmlTextReader reader = <span style="color:Blue; new XmlTextReader(strFilePath))
{
reader.ReadToFollowing(strBusinessNo);
<span style="color:Blue; do
{
docData.DataSet.ReadXml(reader);
} <span style="color:Blue; while (reader.MoveToElement());
ds = docData.DataSet;
ds.AcceptChanges();
<span style="color:Blue; return ds;
}
}
[/code]
Heres my xml file
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <?<span style="color:#A31515; xml <span style="color:Red; version<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1.0<span style="color:Black; " <span style="color:Red; standalone<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; yes<span style="color:Black; "<span style="color:Blue; ?>
<span style="color:Blue; <<span style="color:#A31515; dataSet<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SHXF1110160023<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; a<span style="color:Blue; >a<span style="color:Blue; </<span style="color:#A31515; a<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; b<span style="color:Blue; >b<span style="color:Blue; </<span style="color:#A31515; b<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; c<span style="color:Blue; >c<span style="color:Blue; </<span style="color:#A31515; c<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; d<span style="color:Blue; >xxx<span style="color:Blue; </<span style="color:#A31515; d<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; e<span style="color:Blue; >123<span style="color:Blue; </<span style="color:#A31515; e<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; f<span style="color:Blue; >test<span style="color:Blue; </<span style="color:#A31515; f<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; SHXF1110160023<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SHXF1110160023<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; a<span style="color:Blue; >a<span style="color:Blue; </<span style="color:#A31515; a<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; b<span style="color:Blue; >b<span style="color:Blue; </<span style="color:#A31515; b<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; c<span style="color:Blue; >c<span style="color:Blue; </<span style="color:#A31515; c<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; d<span style="color:Blue; >yyy<span style="color:Blue; </<span style="color:#A31515; d<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; e<span style="color:Blue; >22<span style="color:Blue; </<span style="color:#A31515; e<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; f<span style="color:Blue; >test2<span style="color:Blue; </<span style="color:#A31515; f<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; SHXF1110160023<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; dataSet<span style="color:Blue; >
[/code]
But like my previous code, it just return the first record, i want to return all records(elements) which meet condition <span style="white-spacere strBusinessNo.
<span style="white-spacere How to modify it.
<span style="white-spacere Thanks,
<span style="white-spacere Werewolf, <hr class="sig <b>Just a newbie for everything.</b>
View the full article
I have a simple xml read question. I attached my code here.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; public DataSet getSpecificXmlData(<span style="color:Blue; string strFilePath, <span style="color:Blue; string strBusinessNo)
{
XmlDataDocument docData = <span style="color:Blue; new XmlDataDocument();
DataSet ds = <span style="color:Blue; new DataSet();
<span style="color:Blue; using (XmlTextReader reader = <span style="color:Blue; new XmlTextReader(strFilePath))
{
reader.ReadToFollowing(strBusinessNo);
<span style="color:Blue; do
{
docData.DataSet.ReadXml(reader);
} <span style="color:Blue; while (reader.MoveToElement());
ds = docData.DataSet;
ds.AcceptChanges();
<span style="color:Blue; return ds;
}
}
[/code]
Heres my xml file
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <?<span style="color:#A31515; xml <span style="color:Red; version<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1.0<span style="color:Black; " <span style="color:Red; standalone<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; yes<span style="color:Black; "<span style="color:Blue; ?>
<span style="color:Blue; <<span style="color:#A31515; dataSet<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SHXF1110160023<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; a<span style="color:Blue; >a<span style="color:Blue; </<span style="color:#A31515; a<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; b<span style="color:Blue; >b<span style="color:Blue; </<span style="color:#A31515; b<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; c<span style="color:Blue; >c<span style="color:Blue; </<span style="color:#A31515; c<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; d<span style="color:Blue; >xxx<span style="color:Blue; </<span style="color:#A31515; d<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; e<span style="color:Blue; >123<span style="color:Blue; </<span style="color:#A31515; e<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; f<span style="color:Blue; >test<span style="color:Blue; </<span style="color:#A31515; f<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; SHXF1110160023<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; SHXF1110160023<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; a<span style="color:Blue; >a<span style="color:Blue; </<span style="color:#A31515; a<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; b<span style="color:Blue; >b<span style="color:Blue; </<span style="color:#A31515; b<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; c<span style="color:Blue; >c<span style="color:Blue; </<span style="color:#A31515; c<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; d<span style="color:Blue; >yyy<span style="color:Blue; </<span style="color:#A31515; d<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; e<span style="color:Blue; >22<span style="color:Blue; </<span style="color:#A31515; e<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; f<span style="color:Blue; >test2<span style="color:Blue; </<span style="color:#A31515; f<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; SHXF1110160023<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; dataSet<span style="color:Blue; >
[/code]
But like my previous code, it just return the first record, i want to return all records(elements) which meet condition <span style="white-spacere strBusinessNo.
<span style="white-spacere How to modify it.
<span style="white-spacere Thanks,
<span style="white-spacere Werewolf, <hr class="sig <b>Just a newbie for everything.</b>
View the full article