Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
SolvedPrivate

Handle Ampersand in XML Linq

Posted on 2014-04-23
7
Medium Priority
?
43 Views
Last Modified: 2016-02-15
I am trying to do a LINQ query and have a field that has an Ampersand rendered as &
<StateSpecialty stateKey="Alabama" specialtyKey="L&D" stateName="Alabama" state="AL" specialty="L&D" specialtyMarketing="Labor & Delivery">

For the life of me I cannot get the query to work

Below...I've passed in for _specialty
L&D
L%26D
And..the actual string    L&D
Nothing seems to work

            Dim regionElements = From r In doc.Descendants("StateSpecialty") _
                                 Where r.Attribute("state").Value = _state _
                                 And r.Attribute("specialty").Value = _specialty
                                 Select r

Open in new window

0
Comment
Question by:lrbrister
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40018489
So filling _specialty with "L&D" doesn't work?
0
 

Author Comment

by:lrbrister
ID: 40018513
I get the red underline and this message on mouse over

specialty="L&D"

"Entity D is not defined
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40018566
Huh? In VB?

In other words, if you do this:

Dim regionElements = From r In doc.Descendants("StateSpecialty") _
                                 Where r.Attribute("state").Value = _state _
                                 And r.Attribute("specialty").Value = "L&D"
                                 Select r

Open in new window


...do you still have the error?

One thing I just thought of:  Is this an ASP.NET application? If so, is this query in the markup or the code-behind?
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:lrbrister
ID: 40018583
Kaufmed..
Yes..  vb.net

Code Behind
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 2000 total points
ID: 40018595
If the query is in code-behind, then there should not be an issue. If you are working in the markup, then there could be an issue with encoding, since the ASP.NET markup is (last I recall) XHTML-based.
0
 

Author Comment

by:lrbrister
ID: 40018631
kaufmed...
Taking a look at that when I get back in the office tomorrow.
0
 

Author Closing Comment

by:lrbrister
ID: 40032425
Duh in me...had a typo
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

610 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