Database config in xml file



I need to create DB config file in xml for connecting with db in php application. And I create something like this



<?xml version="1.0"?>
<connection>
<host>localhost</host>
<user>antin</user>
<password>password</password>
<dbase>database</dbase>
</connection>


Then I can get host, user, password and dbase using SimpleXML. But I think that it isn't unsafe because everyone can parse this file. I think that that xml file have to be something like:



<?xml version="1.0"?>
<connection>
<host><![CDATA[localhost]]></host>
<user><![CDATA[antin]]></user>
<password><![CDATA[password]]></password>
<dbase><![CDATA[database]]></dbase>
</connection>


Can you help me to understand the right way for creation xml config file and getting connection info? Thanks!


No comments:

Post a Comment