Jump to content

Newbie: Looping thru XML


wcboyd

Recommended Posts

Hello All,

 

I am trying to extract certain pieces of data from an XML file.

I need to go from start to finish in the file and repeatedly extract two elements from the file.

 

Here is what I have so far, it is not much...

 

<?php

$xml = simplexml_load_file('c:\input.xml');
$fp1 = fopen('c:\output.txt'), 'w');
$num = 0;
foreach ($xml->package->class->name as $RSMClassName)
{
fwrite($fp1 $RSMClassName);
$xml->package->class->rdbPhysicalName as $TableName;
fwrite($fp1 $Tablename);
}
fclose($fp1);

?>

 

But I keep getting the following error:

Parse error: syntax error, unexpected ',' in C:\createddlfromxml.php on line 4

 

What am I doing wrong?  I am sure it is something simple.....

 

 

Thanks!

Link to comment
Share on other sites

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.