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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:35:33+00:00 2026-05-14T18:35:33+00:00

I am loading an xml in php via simplexml_load_file(). I load the file with

  • 0

I am loading an xml in php via simplexml_load_file().

I load the file with that:

$xml = simplexml_load_file('flash/datas/datas.xml');

And the access my content like that:

$descText = $xml->aboutModule->chocolaterie->desc

The text from desc is well registred in my $descText, but all the <br/> of the text disappear… So my long text is on a single line, not so good :-/

Do you know how to solve that? Is there a special traitement to do one the $xml var? Or someting else?

Thank you in advance for your help!

  • 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-14T18:35:33+00:00Added an answer on May 14, 2026 at 6:35 pm

    Two ways to make it work.

    The right one

    Do not store those <br/>. Store the real actual newlines, e.g.

    <desc>
        Line 1.
        Line 2.
    </desc>
    

    Then use nl2br() to replace newlines with HTML tags. This is assuming your description does not normally contain markup. If it does, use CDATA sections as proposed in another answer.

    The other one

    $descText = strip_tags($xml->aboutModule->chocolaterie->desc->asXML(), '<br /><br/>');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 532k
  • Answers 532k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The usual workflow: Provide a Javascript rich-text editor for your… May 17, 2026 at 12:04 am
  • Editorial Team
    Editorial Team added an answer You could also try Aspose Tasks: http://www.aspose.com/categories/.net-components/aspose.tasks-for-.net/default.aspx We are using… May 17, 2026 at 12:04 am
  • Editorial Team
    Editorial Team added an answer ejabberd, written in erlang. Or, jabberd, written in C++, or… May 17, 2026 at 12:04 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I am currently loading HTMl content via AJAX. I have code for things on
Im loading an xml file with tweets and then adding it a to a
I have to load some XML data (generated from a database, using PHP) into
I'm loading an XML document in my C# application with the following: XDocument xd1
I'm trying to load up XML/SWF Charts with Yii and having some troubles. As
I have created an extension for mediawiki that works in all major browsers other
I have a JavaScript slideshow that pre-loads images out of a MySQL database and
We have a job management application running (Access) with the database in SQL Server
I was wondering how i should go about writing an XML data layer for
I am trying to add some administration scripts to a Zend Framework project, that

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.