Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 12th, 2005, 06:59 AM
Authorized User
 
Join Date: Apr 2005
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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







Similar Threads
Thread Thread Starter Forum Replies Last Post
Ch 8: <asp:image> inside <a> & ext.CSS (pg. 274) epc BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 1 July 12th, 2008 04:37 AM
<style> tags in a <body> vs. <div> bcat BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 March 27th, 2005 08:50 AM
<marquee><b>About CHAT App. in PHP4</b></marquee> Ramkrishna PHP How-To 1 September 11th, 2004 07:01 AM
<STRONG> vs <B> and <EM> vs <I> anshul HTML Code Clinic 12 September 1st, 2004 05:22 PM
<<ASP.NET Security>>,download files in chapter 8 alaix All Other Wrox Books 1 July 24th, 2003 10:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.