Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 426351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T19:28:15+00:00 2026-05-12T19:28:15+00:00

How would I go about embedding an html anchor inside of an xml element?

  • 0

How would I go about embedding an html anchor inside of an xml element? Consider the following xml:

<?xml version="1.0" encoding="utf-8"?>
<Customers>
     <Customer>
          <FirstName>Joe</FirstName>
          <LastName>Mama</LastName>
          <Email><a href="mailto:joemama@gmail.com">joemama@gmail.com</a></Email>
          <Website><a href="http://www.joemama.com">www.joemama.com</a></Website>
     </Customer>
</Customer>

When I display the element contents, I only get text, no hyperlinks.

Here is the code I am using to display the xml data in an asp.net web forms page:

CustomerView HTML

<%@ control language="vb" autoeventwireup="false" codebehind="CustomerView.ascx.vb"
    inherits="Sparta.Web.CustomerView" %>
<div class="View">
    <table>
         <tr>
             <td>First Name:</td>
             <td><asp:label id="FirstName" runat="server"></asp:label></td>
         </tr>
         <tr>
             <td>Last Name:</td>
             <td><asp:label id="LastName" runat="server"></asp:label></td>
         </tr>
         <tr>
             <td>Email:</td>
             <td><asp:literal id="Email" runat="server"></asp:literal></td>
         </tr>
         <tr>
             <td>Website:</td>
             <td><asp:literal id="Website" runat="server"></asp:literal></td>
         </tr>
    </table>
</div>

CustomerView Codebehind

Public Partial Class CustomerView
    Inherits System.Web.UI.UserControl

     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
          Me.DataBind()
     End Sub

     Private Sub DataBind()

        Dim xmlDoc As System.Xml.Linq.XDocument = Nothing
        xmlDoc = XDocument.Load(Server.MapPath("~/data/CustomerData.xml"))

        Dim listQuery = _
        From list In xmlDoc.Descendants("Customer") _
        Where list.Element("LastName").Value = Request.QueryString("id") _
        Select _
        FirstName = list.Element("FirstName").Value, _
        LastName= list.Element("LastName").Value, _
        Email = list.Element("Email").Value, _
        Website = list.Element("Website").Value

        Dim listInfo = listQuery(0)
        If listInfo Is Nothing Then
            Throw New ApplicationException("Missing CustomerData Element")
        End If

        Me.FirstName.Text = listInfo.FirstName
        Me.LastName.Text = listInfo.LastName
        Me.Email.Text = listInfo.Email
        Me.Website.Text = listInfo.Website

     End Sub

End Class
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T19:28:15+00:00Added an answer on May 12, 2026 at 7:28 pm

    XML is XML, HTML is HTML. If you are trying to parse XML as HTML then extract the contents of <Email>, which I suggest wrapping with <![CDATA[ and ]]> and spit it out in HTML.

    Also please provide the code you are using to display this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.