How to get specific value from <![CDATA[]]>
Hi All,
I have an sample xml file:
<?xml version="1.0" encoding="UTF-8"?>
<ext>
<information>
<items>
<item>
<col_items>
<dsc>
<![CDATA[<P>Open <EM>Shared-Sketch.ipt</EM></P>
<P> <IMG src="MediaServer?id=00C90408000010C1">
</P>]]>
</dsc>
</col_items>
</item>
<item>
<col_items>
<dsc>
<![CDATA[<P>Open <EM>Shared-Sketch.ipt</EM></P>
<P> <IMG src="MediaServer?id=00C90408000010C2">
</P>]]>
</dsc>
</col_items>
</item>
</items>
</information>
<ext>
Now, How do i get only "id" values from "img" tag which present in CDATA.
I have done something which gives me all the contents present in CDATA but not able to get "id" values.
Code for the same:
Private Function read_data(ByVal foldername As String, ByVal isSrc As Boolean)
Dim m_xmld As XmlDocument
Dim m_attr As XmlAttribute
Dim m_node As XmlNode
Dim m_nodelist As XmlNodeList
Try
' create xml doc
m_xmld = New XmlDocument
m_xmld.Load(mstrInputXMLFile)
m_nodelist = m_xmld.SelectNodes("//row_item/column_items/desc")
For Each m_node In m_nodelist
Dim attrValue = m_node.ChildNodes.Item(0).InnerText
m_nodelist = m_xmld.GetElementsByTagName("img", "//row_item/column_items/desc")
RichTextBox1.Text += attrValue
Dim mywriter As System.IO.TextWriter
mywriter = System.IO.File.CreateText("imgsrc.log")
mywriter.WriteLine(RichTextBox1.Text)
mywriter.Close()
Next
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Function
Can Anyone help me for the same.
Thanks,
Shailesh
|