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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:28:28+00:00 2026-06-13T15:28:28+00:00

test.xml <?xml version=1.0 encoding=UTF-8 ?> <rss version=2.0 xmlns:excerpt=http://wordpress.org/export/1.2/excerpt/ xmlns:content=http://purl.org/rss/1.0/modules/content/ xmlns:wfw=http://wellformedweb.org/CommentAPI/ xmlns:dc=http://purl.org/dc/elements/1.1/ xmlns:wp=http://wordpress.org/export/1.2/ > <item>

  • 0

test.xml

<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
    xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:wp="http://wordpress.org/export/1.2/"
>

    <item>
        <title>Hello world!</title>
        <link>http://localhost/wordpress/?p=1</link>
        <category><![CDATA[Uncategorized]]></category>
        <HEADLINE><![CDATA[Does Sleep Apnea Offer Some Protection During Heart Attack?]]></HEADLINE>
    </item>
</rss>

i used that code read xml file

    <?php
      if (file_exists('test.xml')) {
        $xml = simplexml_load_file('test.xml');
          echo "<pre>";
          print_r($xml);
          echo "</pre>";
      } else {
         exit('Failed to open test.xml.');
         }
     ?>

Output

      SimpleXMLElement Object
 (
 [@attributes] => Array
    (
        [version] => 2.0
    )

[item] => SimpleXMLElement Object
    (
        [title] => Hello world!
        [link] => http://localhost/wordpress/?p=1
        [category] => SimpleXMLElement Object
            (
            )

        [HEADLINE] => SimpleXMLElement Object
            (
            )

    )

 )

but i have problem with those tag in xml

        <category><![CDATA[Uncategorized]]></category>
    <HEADLINE><![CDATA[Does Sleep Apnea Offer Some Protection During Heart Attack?]]></HEADLINE>

 to read data bcoz of it <![CDATA[]] in category and HEADLINE

i need output

        SimpleXMLElement Object
   (
 [@attributes] => Array
    (
        [version] => 2.0
    )

[item] => SimpleXMLElement Object
    (
        [title] => Hello world!
        [link] => http://localhost/wordpress/?p=1
        [category] => Uncategorized
        [HEADLINE] => Does Sleep Apnea Offer Some Protection During Heart Attack?
    )

 )
  • 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-13T15:28:29+00:00Added an answer on June 13, 2026 at 3:28 pm

    Try this when loading the file

    $xml = simplexml_load_file($this->filename,'SimpleXMLElement', LIBXML_NOCDATA);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a style sheet like this <?xml version=1.0 encoding=utf-8?> <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:param
I have a xml like this: <?xml version=1.0 encoding=utf-8?> <assessment xmlns=http://xml.thinkcentral.com/pub/xml/hsp/assessment xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xhtml=http://www.w3.org/1999/xhtml xmlns:tia=http://xml.thinkcentral.com/pub/xml/hsp/tia
I'm editing XML element with the following XML: <?xml version=1.0 encoding=utf-8?> <!--Test XML with
<?xml version='1.0' encoding='utf-8' standalone='yes'?> <stock-items> <stock-item> <name>Loader 34</name> <sku>45GH6</sku> <vendor>HITINANY</vendor> <useage>Lifter 45 models B
I have a file test.xml with the following content : <body> <content> <p>Lorem ipsum
I'm trying to create a http request to our web service, my test XML
I have an XML document being sent to me by HTTP POST: <?xml version=1.0
I am running PHP unit as follows: phpunit --debug --verbose --coverage-clover=/tmp/test.xml and get the
I'm trying to disable log output from all external libraries in logback-test.xml. Somehow it
I have the following test case: @ContextConfiguration(/spring/test-context.xml) @TransactionConfiguration(transactionManager=txManager) @Transactional() public class MyEntityDaoTestCase extends AbstractJUnit4SpringContextTests

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.