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 8809973
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:00:37+00:00 2026-06-14T03:00:37+00:00

I have an XML exported from another website that contains CDATA but this CDATA

  • 0

I have an XML exported from another website that contains CDATA but this CDATA when reference back to the website is actually a URL link. I can parse this CData into PHP but it would be shown as text. Is there a way I can link this CData back to the website where the URL is? Or I need the URL to be in the CData to be parse instead?

—From other website—e.g http://www.otherwebsite.com

e.g Node from XML

<SongTitle><![CDATA[This is a song link at www.otherwebsite.com]]></SongTitle>

Many thanks.

  • 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-06-14T03:00:38+00:00Added an answer on June 14, 2026 at 3:00 am

    Try preg_match_all when you have loaded the file into a string..

    $string=  '<![CDATA[This is a song link at www.otherwebsite.com]]>'; // string of data or your xml file...
    
    preg_match_all('/<!\[(CDATA)\[\s*(.*?)\s*\]\]>/',$string,$out);
    
    $current_link = $out[2][0]; // print_r($_out); to see what is in this new array...
    $current_link = str_replace("This is a song link at ","",$current_link); // now remove clutter
    echo $current_link;
    

    if you want to handle multiple occurances of CData….

    $var =  ' sdf sdf sdf<![CDATA[This is a song link at www.awesome.com]]> sdf sdf sd<![CDATA[This is a song link at www.google.com]]><![CDATA[This is a song link at www.amazon.com]]>';
    
    preg_match_all('/<!\[(CDATA)\[\s*(.*?)\s*\]\]>/',$var,$out);
    $array_of_links = $out[2];
    
    foreach($array_of_links as $link){
        $current_link = str_replace("This is a song link at ","",$link);
        echo $current_link;
        echo "<br />";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several fairly large XML files that represent data exported from a system
For example if I have an XML file (exported from another app, so I
I have XML that looks like this: <Parameter Name=parameter name Value=parameter value /> which
I have xml like this: <configurationData> <path name='b'> <path name='a'> <setting name='s1'> ![CDATA[XXXX]] </setting>
I have XML that looks like this: <ROW ref=0005631 type=04 line=1 value=Australia/> <ROW ref=0005631
I have an XML exported from Oracle DB, which will be downloaded into my
I have to complete this task: I'm given a xml file which is exported
I just received an XML file that was exported from Hyperion. The XLM follows:
Okay... We have a contact books in Exchange that gets exported into an XML
need the help from the XML, XSLT experts. I have 2 sample records exported

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.