2
I want to only get the XML numbers with PHP:
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
...
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
...
</ExcelWorkbook>
<Styles>
...
</Styles>
<ss:Worksheet ss:Name="Planilha1">
<Table ss:StyleID="ta1">
<Column ss:Span="23" ss:Width="48.19"/>
<Column ss:Index="25" ss:Width="74.61"/>
<Column ss:Width="103.95"/>
<Column ss:Span="37" ss:Width="48.19"/>
<Row ss:Height="15">
<Cell>
<Data ss:Type="String">n1</Data>
</Cell>
<Cell>
<Data ss:Type="String">n2</Data>
</Cell>
<Cell>
<Data ss:Type="String">n3</Data>
</Cell>
<Cell>
<Data ss:Type="String">n4</Data>
</Cell>
</Row>
<Row ss:Height="15">
<Cell>
<Data ss:Type="Number">1</Data>
</Cell>
<Cell>
<Data ss:Type="Number">2</Data>
</Cell>
<Cell>
<Data ss:Type="Number">4</Data>
</Cell>
</Row>
<Row ss:Height="15">
<Cell>
<Data ss:Type="Number">2</Data>
</Cell>
<Cell>
<Data ss:Type="Number">6</Data>
</Cell>
<Cell>
<Data ss:Type="Number">8</Data>
</Cell>
<Cell>
<Data ss:Type="Number">9</Data>
</Cell>
Things I’ve tried before:
$temporario = $_FILES["Arquivo"]["tmp_name"];
$xml = simplexml_load_file($temporario);
foreach($xml->Table->Row->Cell as $Cell) {
print_r("NUMEROS $Cell\n");
}
foreach($xml->ss:Worksheet->Row->Cell as $Cell) {
print_r("NUMEROS $Cell\n");
}
I left an answer to better understand how Simplexmlelement works. I ended up assembling an own XML, because in the question, the XML is incomplete
– Wallace Maxters