Re: PEAR::Config Question
| From: | Paul Holt | Date: | Sat, 09 Apr 2005 21:09:34 +0000 |
| Subject: | Re: PEAR::Config Question | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-18659@lists.php.net to get a copy of this message | ||
No! No! Changed my mind... use SimpleXML instead! http://www.php.net/simplexml
<?
$config = simplexml_load_file("config.xml");
echo $config->rdbms->source['type'];
?>
Outputs "mssql" !
On Apr 9, 2005 9:54 PM, Paul Holt <pcholt@gmail.com> wrote:
> I'd use http://www.php.net/domxml in PHP4 or
> http://www.php.net/dom in
> PHP5. They're excellent for files where the file size is limited so
> you won't mind reading the entire file into a data structure in
> memory.
>
> On Apr 9, 2005 3:31 AM, Ammar Ibrahim <ammar@gnuix.com> wrote:
> > I'm writing a MSSQL to MySQL Migration Utility, I'm using *Config* to
> > manage the configuration, I want it to read from an XML file. The
> > sturcutre is provided below. Now I want to be able to loop over
> > 'databases' & 'tables'.
> >
> > What's the best way to do this, I'd rather stay away from arrays, is
> > there a DOM access like way to get the objects. And is there a better
> > way to structure my XML?
> >
> > <config>
> > <rdbms>
> > <source type="mssql">
> > <host></host>
> > <user></user>
> > <pass></pass>
> > </source>
> > <destination type="mssql">
> > ....
> > </destination>
> >
> > </rdbms>
> >
> > <databases>
> > <database newname="legs_jo">JOLEGSZEFT</database>
> > </databases>
> >
> > <tables>
> > <table newname="foo">
> > <name>bar</name>
> > <columns>
> > <col newname="new_col_name"
> > callback="intToDate>start_date</col>
> > </columns>
> > </table>
> > </tables>
> > </config>
> >
> > --
> > PEAR General Mailing List (http://pear.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>