0

Hye! Can I read an xml file like:

<items>
<item>
<id_product>1</id_product>
<title>Product title</title>
<description><p>This is a<b>PRODUCT</b></p></description>
</item>
<item>
<id_product>2</id_product>
<title>Another Product title</title>
<description><p>This is the second <b>PRODUCT</b></br><a href="#">click here</a></p></description>
</item>
</itmes>

and with php to write this into a database? The think is that I want to write it with formatting also ( anchor, bold, italic, p, etc )

nickRO87
  • 103
  • 3
  • 8
  • possible duplicate: http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php – echolocation Mar 21 '14 at 17:42
  • Your xml is broken. The closing tag is wrong. IT looks like a part of an RSS feed. But in RSS the description is often a text/cdata node with an html fragment. If it is you have to read the xml element first, and the html fragment second see: http://stackoverflow.com/questions/22479419/how-to-exextract-list-values-within-xml-elements-using-php/22490106#22490106 – ThW Mar 21 '14 at 21:47

1 Answers1

0

Check out the PHP Manual for PHP's XML Parser

You should be able to get the information using those tools, and then write it into your database.

echolocation
  • 1,120
  • 1
  • 10
  • 28