easy PHP+XML parser

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rafal 'Raf256' Maj

    #1

    easy PHP+XML parser



    Hi,
    I have data like:

    <?xml version="1.0" encoding="ISO-8859-2"?>
    <news>
    <post>
    <date>10.04.200 4</date>
    <text>Test test test</text>
    </post>
    <post>
    <date>15.04.200 4</date>
    <text>Bleh bleh bleh <a href="www.test" >test</a></text>
    </post>
    </news>

    and I want to have it in PHP as array looking like:

    array(
    [0] =>
    array(
    date => "10.04.2004 "
    text => "Test test test"
    )
    [1] =>
    array (
    date => "15.04.2004 "
    text => "Bleh bleh bleh <a href="www.test" >test</a>"
    )
    )

    problem - text can have some HTML tags, so I want to just have it all in
    string.

    How can I do this in PHP if I have XML data in some data.xml ?



    --
    ~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~l-.~~~~~~~~~~~~~~ ~~~~~
    GG-1175498 ____| ]____,
    Rafal 'Raf256' Maj X-( * )
    Rafal(at)Raf256 (dot)com ,"----------"
Working...