PARCOURIR LE DOM,
Utilisateur anonyme
-
Utilisateur anonyme -
Utilisateur anonyme -
Bonjour,
J'arrrive à mettre dans un dossier sur le serveur un fichier ods, puis à le convertir en . zip, puis extraire content.xml (c est mon but = le fichier xml) puis à afficher l'arbre dom. Mai je n'arrive pas le parcourir , afin de le mettre dans UN BASE DE DONNÉE ET LE RÉ AFFICHER COMME TABLEAU
VOICI MON CODE :
MERCI DE VOTRE AIDE
J'arrrive à mettre dans un dossier sur le serveur un fichier ods, puis à le convertir en . zip, puis extraire content.xml (c est mon but = le fichier xml) puis à afficher l'arbre dom. Mai je n'arrive pas le parcourir , afin de le mettre dans UN BASE DE DONNÉE ET LE RÉ AFFICHER COMME TABLEAU
VOICI MON CODE :
<!DOCTYPE html> <html> <head> <title>Les Glaces du Lac - Rentabilité</title> <meta charset="UTF-8" /> </head> <body> <form action="index.php" method="post" enctype="multipart/form-data"> <input type="file" name="file" /> <input type="submit" /> </form> <?php if (isset($_FILES['file'])) { if ($_FILES['file']['error'] == 0) { if ($_FILES['file']['size'] <= 1000000) { $infosfichier = pathinfo($_FILES['file']['name']); $extension_upload = $infosfichier['extension']; $extensions_autorisees = array('ods'); if (in_array($extension_upload, $extensions_autorisees)) { move_uploaded_file($_FILES['file']['tmp_name'], 'uploads/' . basename($_FILES['file']['name'])); echo "L'envoi a bien été effectué !"; $adress = "./uploads/" . $_FILES["file"]["name"]; $element['filename'] = $_FILES["file"]["name"]; $element["extension"] = "zip"; $nomAvecExt = "./uploads/" . $element['filename'] . '.' . $element['extension']; rename($adress, $nomAvecExt); $zip = new ZipArchive; $res = $zip -> open($nomAvecExt); if ($res === TRUE) { $zip -> extractTo("./uploads/", array('content.xml')); $zip -> close(); $doc = new DOMDocument(); $doc -> load("./uploads/content.xml"); echo $doc -> saveXML(); $text = $doC -> getElementsByTagName('text:p'); foreach ($text as $text) { echo $text -> nodeValue, PHP_EOL; } } else { echo 'échec'; } } } } } ?> </body> </html>
MERCI DE VOTRE AIDE
A voir également:
- PARCOURIR LE DOM,
- Flirt dom tom - Forum Jeux vidéo
- Je cherche un site de rencontre sérieux et pas cher ✓ - Forum Consommation & Internet
- Crush dom tom - Forum Free mobile
- Comment ouvrir un compte PayPal en Guadeloupe. ? - Forum Réseaux sociaux
- Candy Crush Saga se charge sans s'ouvrir - Forum Jeux vidéo
1 réponse
Re la question que je me pose, sur le style de contenu que j'obtient
voici un exemple :
Bon la c'est un simple exemple, d'habitude il est sous forme de bloc condenser mais la je l'ai mi en forme pour plus de lisibilité
on voit que les information sont en namespace par exemple text:p
je n'arrive pas a parcourir se type de balise
voici un exemple :
<?xml version="1.0" encoding="UTF-8"?> <office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML/" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css-text-3/" office:version="1.2"> <office:scripts/> <office:font-face-decls> <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/> <style:font-face style:name="DejaVu Sans" svg:font-family="'DejaVu Sans'" style:font-family-generic="system" style:font-pitch="variable"/> <style:font-face style:name="Droid Sans Fallback" svg:font-family="'Droid Sans Fallback'" style:font-family-generic="system" style:font-pitch="variable"/> <style:font-face style:name="Lohit Hindi" svg:font-family="'Lohit Hindi'" style:font-family-generic="system" style:font-pitch="variable"/> </office:font-face-decls> <office:automatic-styles> <style:style style:name="co1" style:family="table-column"> <style:table-column-properties fo:break-before="auto" style:column-width="3.602cm"/> </style:style> <style:style style:name="co2" style:family="table-column"> <style:table-column-properties fo:break-before="auto" style:column-width="2.258cm"/> </style:style> <style:style style:name="ro1" style:family="table-row"> <style:table-row-properties style:row-height="0.427cm" fo:break-before="auto" style:use-optimal-row-height="true"/> </style:style> <style:style style:name="ro2" style:family="table-row"> <style:table-row-properties style:row-height="0.452cm" fo:break-before="auto" style:use-optimal-row-height="true"/> </style:style> <style:style style:name="ta1" style:family="table" style:master-page-name="Default"> <style:table-properties table:display="true" style:writing-mode="lr-tb"/> </style:style> </office:automatic-styles> <office:body> <office:spreadsheet> <table:table table:name="Feuille1" table:style-name="ta1"> <table:table-column table:style-name="co1" table:default-cell-style-name="Default"/> <table:table-column table:style-name="co2" table:number-columns-repeated="2" table:default-cell-style-name="Default"/> <table:table-row table:style-name="ro1"> <table:table-cell office:value-type="string"> <text:p>nom</text:p> </table:table-cell> <table:table-cell office:value-type="string"> <text:p>prénom</text:p> </table:table-cell> <table:table-cell office:value-type="string"> <text:p>age</text:p> </table:table-cell> </table:table-row> <table:table-row table:style-name="ro1"> <table:table-cell office:value-type="string"> <text:p>mickael</text:p> </table:table-cell> <table:table-cell office:value-type="string"> <text:p>Anthony</text:p> </table:table-cell> <table:table-cell office:value-type="float" office:value="18"> <text:p>18</text:p> </table:table-cell> </table:table-row> <table:table-row table:style-name="ro1"> <table:table-cell office:value-type="string"> <text:p>Stéphane</text:p> </table:table-cell> <table:table-cell office:value-type="string"> <text:p>pierre</text:p> </table:table-cell> <table:table-cell office:value-type="float" office:value="22"> <text:p>22</text:p> </table:table-cell> </table:table-row> </table:table> <table:named-expressions/> </office:spreadsheet> </office:body> </office:document-content>
Bon la c'est un simple exemple, d'habitude il est sous forme de bloc condenser mais la je l'ai mi en forme pour plus de lisibilité
on voit que les information sont en namespace par exemple text:p
je n'arrive pas a parcourir se type de balise