G
Guest
Hello all,
In the below XML:
- <comment_list description="Comment list">
- <comment description="Comment" item_no="1">
<date description="Date">2006-09-27</date>
<author description="Author">HKGE0406505.001</author>
<visible_to description="Visible to">P</visible_to>
<comment description="Comment">086095.</comment>
</comment>
- <comment description="Comment" item_no="2">
<date description="Date">2006-09-27</date>
<author description="Author">E0760.116</author>
<visible_to description="Visible to">P</visible_to>
<comment description="Comment">time adjuster</comment>
</comment>
</comment_list>
and using the below code
using (XmlReader reader = XmlReader.Create(@"c:\xml\isn_prod.XML-0139.xml"))
{
reader.MoveToContent();
reader.ReadToDescendant("claimkey");
sb.Append("ClaimKey: " + reader.GetAttribute("id"));
reader.ReadToFollowing("comment_list");
reader.ReadToDescendant("comment");
reader.ReadToDescendant("date");
sb.Append(" Date: " +
reader.ReadElementContentAsString());
sb.Append(" Author: " +
reader.ReadElementContentAsString());
reader.ReadToFollowing("visible_to");
sb.Append(" visible to: " +
reader.ReadElementContentAsString());
sb.Append(" comment: " +
reader.ReadElementContentAsString());
string a = sb.ToString();
}
I can happily navigate comment item number 2, but I can't seem to find a way
to get to the comment nodes (id=2).
Any help would be great,
Thanks,
Jon
In the below XML:
- <comment_list description="Comment list">
- <comment description="Comment" item_no="1">
<date description="Date">2006-09-27</date>
<author description="Author">HKGE0406505.001</author>
<visible_to description="Visible to">P</visible_to>
<comment description="Comment">086095.</comment>
</comment>
- <comment description="Comment" item_no="2">
<date description="Date">2006-09-27</date>
<author description="Author">E0760.116</author>
<visible_to description="Visible to">P</visible_to>
<comment description="Comment">time adjuster</comment>
</comment>
</comment_list>
and using the below code
using (XmlReader reader = XmlReader.Create(@"c:\xml\isn_prod.XML-0139.xml"))
{
reader.MoveToContent();
reader.ReadToDescendant("claimkey");
sb.Append("ClaimKey: " + reader.GetAttribute("id"));
reader.ReadToFollowing("comment_list");
reader.ReadToDescendant("comment");
reader.ReadToDescendant("date");
sb.Append(" Date: " +
reader.ReadElementContentAsString());
sb.Append(" Author: " +
reader.ReadElementContentAsString());
reader.ReadToFollowing("visible_to");
sb.Append(" visible to: " +
reader.ReadElementContentAsString());
sb.Append(" comment: " +
reader.ReadElementContentAsString());
string a = sb.ToString();
}
I can happily navigate comment item number 2, but I can't seem to find a way
to get to the comment nodes (id=2).
Any help would be great,
Thanks,
Jon