Jump to content

Recommended Posts

this is a bad question, we don't write scripts for others nor do we share :P therefor i shall give you the first pieces and you shall have to figure out how it will work further on

 

$xml = xml_parser_create();

$dir = "path/fo/xml/directory";

$dh = opendir($dir);

if ($dh) {

  while ($file = readdir($dh)) {

    if ($file != "." && $file != "..") {

      $path = $dir . DIRECTORY_SEPARATOR . $file;

      $data = file_get_contents($path);

      if (0 !== xml_parse($xml, $data)) {

          // i gave you the first pieces, the rest of the puzzle shall you have to figure out by yourself

      }

    }

  }

}

  • 1 month later...

would you say this is correct?

<?php

$query="SELECT * FROM Suppliers WHERE CITY='Barcelona'";

$result = mysql_query($query) or die(mysql_error());

 

 

 

$array = array();

while($row = mysql_fetch_assoc($result)) {

  $array[] = $row["XML_PATH"];

 

 

}

 

?>

<?php foreach (glob('$array[]') AS $filename) {

    $data = file_get_contents($filename);

    $sxml = simplexml_load_string($data);

    //etc etc

}?>

 

or did i mess it up?

Nah, you messed it up. >_<

 

<?php
$query="SELECT * FROM Suppliers WHERE CITY='Barcelona'";
$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_assoc($result)) {
  foreach (glob("{$row['XML_PATH']}/*") AS $filename) {
    $data = file_get_contents($filename);
    $sxml = simplexml_load_string($data);
    //etc etc
}


}

?>

ok fixed this

 

apparently empty fields raise this error

 

so i filled them up :)

 

now ill need to parse the data,

 

and as they are different xml schemas this will be a challenge, including different date formats

 

any suggestions how to tackle this?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.