Hi
I am walking xml using c# and i want add attribute (style="text-decoration: line-through;" ) to the parent node of text node if the value meets some condition.
e.g if this element <div >include</div> as include doesn't contain "read" i want <div style="text-decoration: line-through;">inclu de</div>
Here is wht i am doing
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(xm ldoc);
XmlNodeReader reader = new XmlNodeReader(x Doc);
while (!reader.EOF)
{
reader.Read();
XmlNodeType nodeType = reader.NodeType ;
Console.WriteLi ne(reader.Value );
if (nodeType == XmlNodeType.Ele ment)
{
for (int i = 0; i < reader.Attribut eCount; i++)
{
//do something
}
}
else if (nodeType == XmlNodeType.Tex t)
{
if (reader.Value.T oString().Conta ins("read"))
{
//do something
}
else
{
//i want to add attribute to the parent element of this text node
}
}
} //end while
Can any one give me suggestiongs how to do it
Thank you
I am walking xml using c# and i want add attribute (style="text-decoration: line-through;" ) to the parent node of text node if the value meets some condition.
e.g if this element <div >include</div> as include doesn't contain "read" i want <div style="text-decoration: line-through;">inclu de</div>
Here is wht i am doing
XmlDocument xDoc = new XmlDocument();
xDoc.LoadXml(xm ldoc);
XmlNodeReader reader = new XmlNodeReader(x Doc);
while (!reader.EOF)
{
reader.Read();
XmlNodeType nodeType = reader.NodeType ;
Console.WriteLi ne(reader.Value );
if (nodeType == XmlNodeType.Ele ment)
{
for (int i = 0; i < reader.Attribut eCount; i++)
{
//do something
}
}
else if (nodeType == XmlNodeType.Tex t)
{
if (reader.Value.T oString().Conta ins("read"))
{
//do something
}
else
{
//i want to add attribute to the parent element of this text node
}
}
} //end while
Can any one give me suggestiongs how to do it
Thank you
Comment