Al fin me salio. Yo creo que le puede servir a alguien
Archivosphp
prueva.php Código PHP:
<?php
// Carga una cadena XML desde un archivo...
$xmlstr = file_get_contents( 'noticas.xml' );
$library = new SimpleXMLElement( $xmlstr );
// Carga un archivo XML
$library = new SimpleXMLElement('noticas.xml', null, true);
echo '<table>';
echo '<tr>';
echo '<th>Title</th><th>Author</th>
<th>Publisher</th><th>ISBN</th>';
echo '</tr>';
foreach( $library->book as $book ) {
echo '<tr>';
echo '<td>' . $book->title . '</td>';
echo '<td>' . $book->author . '</td>';
echo '<td>' . $book->publisher . '</td>';
echo '<td>' . $book['isbn'] . '</td>';
echo '<td>' . $book->song . '</td>';
echo '</tr>';
}
echo '</table>';
echo '<table>';
echo '<tr>';
echo '<th>Title</th><th>Author</th>
<th>Publisher</th><th>ISBN</th>';
echo '</tr>';
foreach( $library->songs as $songs ) {
echo '<tr>';
echo '<td>' . $songs->title . '</td>';
echo '<td>' . $songs->author . '</td>';
echo '<td>' . $songs->publisher . '</td>';
echo '<td>' . $songs['isbn'] . '</td>';
echo '<td>' . $songs->song . '</td>';
echo '</tr>';
}
echo '</table>';
Novede.xml Código PHP:
<library>
<book isbn="0345342968">
<title>Fahrenheit 451</title>
<author>R. Bradbury</author>
<publisher>Del Rey</publisher>
</book>
<songs isbn="0345342968">
<title>Fahrenheit 451</title>
<author>R. Bradbury</author>
<publisher>Del Rey</publisher>
<song>Luis Sagastume</song>
</songs>