Solved

ASP.NET VB.NET and using a code block for CDATA in XML

Posted on 2008-06-18
2
1,378 Views
Last Modified: 2013-11-07
I want to use a code block <%= %> to specify a string in a CDATA node of an xml doc.  I am using VB.NET, so I am writing the XML directly in the response (VS2008).

The first example WORKS.  The 2nd example DOES NOT.  The difference is that I am using a code block to get the Product code for my url in the CDATA text node.

Ideas?  I prefer NOT to create the XML doc itself as I have a whole lot of these to develop and prefer to use the slick VB.NET xml editing feature for the Write method.

TIA,
Ken
Response.Write(<description><![CDATA[<img align='left' src='https://www.server1.com/ImageHandler.ashx?code=192932'/>]]><%= Left(x.ProductDesc, 180) %>...</description>)
 
 
Response.Write(<description><![CDATA[<img align='left' src='https://www.server1.com/ImageHandler.ashx?code=<%= x.ProductCode %>'/>]]><%= Left(x.ProductDesc, 180) %>...</description>)

Open in new window

0
Comment
Question by:michelle0
2 Comments
 
LVL 24

Expert Comment

by:Jeff Certain
ID: 21817993
Perhaps try
src=<%= "https://www.server1.com/ImageHandler.ashx?code=" & x.ProductCode %>
0
 
LVL 1

Accepted Solution

by:
michelle0 earned 0 total points
ID: 21818003

I GOT IT!

Response.Write(<description><%= New XCData("<img align='left' src='https://www.server1.com/ImageHandler.ashx?code=" & x.ProductCode & "'/>") %><%= Left(x.ProductDesc, 180) %>...</description>)
 
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question