Hi Randy,
Do you need to put Inner: tag before each descendent of "wx" element? If
so, you have to go through each sub-node of it and print them. Here is an
example:
using (XmlReader reader =
XmlReader.Create(@"c:\AutoComplaintSample.xml"))
{
while (reader.Read())
{
if (reader.IsStartElement())
{
if (reader.IsEmptyElement)
Console.WriteLine("<{0}/>", reader.Name);
else
{
Console.WriteLine("<{0}", reader.Name);
reader.Read(); // Read the start tag.
if (reader.IsStartElement()) // Handle nested
elements.
{
if (reader.Name == "wx") //Try to get
all child values for wx tag
{
//if it's a child value of wx, add the
word Inner to the writeline:
Console.WriteLine("<{0}>", reader.Name);
XmlReader subreader =
reader.ReadSubtree();
subreader.Read();
while (subreader.Read())
{
switch (subreader.NodeType)
{
case XmlNodeType.Element:
Console.Write("Inner:
<{0}", reader.Name);
while
(subreader.MoveToNextAttribute())
{
Console.Write("
{0}='{1}'", reader.Name, reader.Value);
}
Console.Write(">");
break;
case XmlNodeType.Text:
Console.Write(subreader.Value);
break;
case XmlNodeType.EndElement:
Console.Write("</{0}>\n",
subreader.Name);
break;
}
}
//Console.WriteLine(reader.ReadString());
//break;
}
else
Console.Write("\r\n</{0}>",
reader.Name);
}
Console.WriteLine(reader.ReadString()); //Read
the text content of the element.
}
}
}
}
Kevin Yu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
(This posting is provided "AS IS", with no warranties, and confers no
rights.)