Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> przetwazanie pliku XML
-Guest-
post
Post #1





Goście







chce przetwozyc plik XML a dkoladnie generowany przez Excel wiec wczytuje go przez simplexml i che sie dobrac do atrybutow ale maja one taka postac:
Kod
<Table ss:ExpandedColumnCount="3" ss:ExpandedRowCount="4" x:FullColumns="1"
   x:FullRows="1">
   <Row>
    <Cell><Data ss:Type="String">kolumna1</Data></Cell>
    <Cell ss:MergeAcross="1"><Data ss:Type="String">kolumna2_zlacz</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">aaa</Data></Cell>
    <Cell><Data ss:Type="String">bbbb</Data></Cell>
    <Cell><Data ss:Type="String">ccc</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">SSS</Data></Cell>
    <Cell><Data ss:Type="String">SWE</Data></Cell>
    <Cell><Data ss:Type="String">TEST</Data></Cell>
   </Row>
   <Row>
    <Cell><Data ss:Type="String">asas</Data></Cell>
    <Cell><Data ss:Type="String">adad</Data></Cell>
    <Cell><Data ss:Type="String">afaf</Data></Cell>
   </Row>
  </Table>


nie wiem jak sie dobrac do ss:ExpandedColumnCount
  1. <?php
  2. $xml = simplexml_load_file('test.xml');
  3. echo $xml->Table['ExpandedColumnCount'];
  4.  
  5. ?>
to cos takiego nie dziala (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) jak dam $xml->Table['ss:ExpandedColumnCount']; to tez nie (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) wiec jak mam sie do tego dobrac?(IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
-Guest-
post
Post #2





Goście







niebardzo (IMG:http://forum.php.pl/style_emoticons/default/sad.gif)

caly plik XML wyglada tak:
  1. <?xml version="1.0"?>
  2. <?mso-application progid="Excel.Sheet"?>
  3. <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
  4. xmlns:o="urn:schemas-microsoft-com:office:office"
  5. xmlns:x="urn:schemas-microsoft-com:office:excel"
  6. xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
  7. xmlns:html="http://www.w3.org/TR/REC-html40">
  8. <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
  9. <Author>zzz</Author>
  10. <LastAuthor>zzz</LastAuthor>
  11. <Created>2006-01-15T14:03:24Z</Created>
  12. <Company>niepowiem</Company>
  13. <Version>11.6505</Version>
  14. </DocumentProperties>
  15. <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  16. <WindowHeight>13185</WindowHeight>
  17. <WindowWidth>15120</WindowWidth>
  18. <WindowTopX>480</WindowTopX>
  19. <WindowTopY>30</WindowTopY>
  20. <ProtectStructure>False</ProtectStructure>
  21. <ProtectWindows>False</ProtectWindows>
  22. </ExcelWorkbook>
  23. <Styles>
  24. <Style ss:ID="Default" ss:Name="Normal">
  25. <Alignment ss:Vertical="Bottom"/>
  26. <Borders/>
  27. <Font x:CharSet="238"/>
  28. <Interior/>
  29. <NumberFormat/>
  30. <Protection/>
  31. </Style>
  32. </Styles>
  33. <Worksheet ss:Name="Arkusz1">
  34. <Table ss:ExpandedColumnCount="3" ss:ExpandedRowCount="4" x:FullColumns="1" x:FullRows="1">
  35. <Row>
  36. <Cell><Data ss:Type="String">kolumna 1</Data></Cell>
  37. <Cell><Data ss:Type="String">kolumna 2</Data></Cell>
  38. <Cell><Data ss:Type="String">kolumna 3</Data></Cell>
  39. </Row>
  40. <Row>
  41. <Cell><Data ss:Type="String">aaa</Data></Cell>
  42. <Cell><Data ss:Type="String">bbbb</Data></Cell>
  43. <Cell><Data ss:Type="String">cccc</Data></Cell>
  44. </Row>
  45. <Row>
  46. <Cell><Data ss:Type="String">1q1q1q</Data></Cell>
  47. <Cell><Data ss:Type="String">2w2w2w</Data></Cell>
  48. <Cell><Data ss:Type="String">3e3e3e</Data></Cell>
  49. </Row>
  50. <Row>
  51. <Cell><Data ss:Type="String">zzz</Data></Cell>
  52. <Cell><Data ss:Type="String">xxx</Data></Cell>
  53. <Cell><Data ss:Type="String">qqq</Data></Cell>
  54. </Row>
  55. </Table>
  56. <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
  57. <PageSetup>
  58. <PageMargins x:Bottom="0.984251969" x:Left="0.78740157499999996"
  59. x:Right="0.78740157499999996" x:Top="0.984251969"/>
  60. </PageSetup>
  61. <Selected/>
  62. <ProtectObjects>False</ProtectObjects>
  63. <ProtectScenarios>False</ProtectScenarios>
  64. </WorksheetOptions>
  65. </Worksheet>
  66. </Workbook>


jest to prosty plik excel zapisany jako xml (IMG:http://forum.php.pl/style_emoticons/default/smile.gif) chce wyciagnac z niego miedzy innymi to ss:ExpandedColumnCount="3" a dokladnie wartosc 3 (IMG:http://forum.php.pl/style_emoticons/default/smile.gif)
  1. <?php
  2.  
  3. $xml = simplexml_load_file('excel.xml');
  4. echo $xml->DocumentProperties->Worksheet->Table['ss:ExpandedColumnCount'];
  5. ?>
to nie dziala (IMG:http://forum.php.pl/style_emoticons/default/sad.gif) ani $xml->DocumentProperties->Worksheet->Table['ExpandedColumnCount'];
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 9.10.2025 - 19:21