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

  • Home
  • SEARCH
  • 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 4069516
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T16:30:39+00:00 2026-05-20T16:30:39+00:00

I can parse the xml with jquery. Now I want the parsed text to

  • 0

I can parse the xml with jquery. Now I want the parsed text to be a hyperlink instead of simple text. Below is what I have written.

 $(xml).find("customers")
     .each(function(){
          $("#guys").append("<div class="mybox"><a href="+$(this).find('customer_link').text()+"target="_blank">"+$(this).find('customer_company').text()"</a></div>");                                                                                      

});

And here is the XML

    <customer_company><![CDATA[Google<br>]]></customer_company>
    <customer_link>http://www.google.com</customer_link>

</myguys>

<myguys>

    <customer_company><![CDATA[EMC<br>]]></customer_company>
    <customer_link>http://www.emc.com</customer_link>

</myguys>
</info>

I know there is nothing wrong in logic, I think this is just a syntax error with the a tag. Can somebody tell me where I am doing a mistake here and point me to a nice tutorial

  • 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-20T16:30:40+00:00Added an answer on May 20, 2026 at 4:30 pm

    You’re mixing quote styles. Single quoted (') strings can contain unescaped double quotes (") and vice-versa. Having unescaped double quotes in your double-quoted string is breaking your code.

    $("#guys").append("<div class="mybox"><a href="+$(this).find('customer_link')
    ss^   se^       ss^         se^   ss^       se^            ss^           se^   
    
    .text()+"target="_blank">"+$(this).find('customer_company').text()"</a></div>"); 
          ss^     se^    ss^e^            ss^              se^      ss^        se^ 
    
    ss == string start,
    se == string end 
    

    You can see how this creates random undefined references like mybox, but doesn’t build the string you intended.
    Try this:

    $("#guys").append("<div class='mybox'><a href=" + 
        $(this).find("customer_link").text() +
        "' target='_blank'>" + 
        $(this).find("customer_company").text() + 
        "</a></div>");  
    

    Alternatively, you can use jQuery to build all the elements and completely avoid having attributes with quotes embedded in your string:

     $("#guys").append($("<div />")
                          .addClass("mybox")
                          .append($('<a/>', {  
                              href: $(this).find("customer_link").text(),  
                              target: "_blank",  
                              text: $(this).find("customer_company").text()  
                          })));
    

    The CDATA in your xml is going to cause jQuery problems because it is parsing the xml like it’s html, not according to the xml specs. You may be better off parsing your xml with a plugin like jParse if you can’t remove the CDATA and <br> from the customer_company element.

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

Sidebar

Related Questions

How can I parse a document with a text/html header as a xml document
hi i have xml file whitch i want to parse, it looks something like
Ok, so I can parse the XML with jQuery but it only seems to
I am trying to parse XML feeds from YouTube using jQuery (by doing $(xml).find(...)
Suppose I have the following XML structure: <root> <item> <item1>some text is <b>here</b></item1> <item2>more
How can one parse HTML/XML and extract information from it?
How can I parse this xml page http://evercore:david10@feeds.outgard.net/www.sportsbook.com/trends/203.xml using PHP simplexml? I get an
If all tables I want to delete from have the column gamer_id can i
Can you suggest some of the best XML Parser for C ?
Is there any tool that can parse a valid C program and generate a

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.