delphiusr
asked on
parsing a database setting file
Hi!
I would like to know if there is any function or method which I can use to parse my database setting file (ie. database.xml). For example, in my web.xml file I indicated
the following:
<servlet>
<servlet-name>database</se rvlet-name >
<servlet-class>myproj.serv let.InitSe rvlet </servlet-class>
<init-param>
<param-name>database</para m-name>
<param-value>/WEB-INF/data base.xml</ param-valu e>
</init-param>
<load-on-startup>1</load-o n-startup>
</servlet>
I was overriding the init method of the InitServlet class which extends HttpServlet class. because of the structure of my web.xml file, I could only get the database file which contains the setting, and this is through getInitParameter("database "), so now, how would I be able to parse the web.xml file to set the properties of the data source like setDriverClass and setUrl?
Thanks in advance!
Raymond
I would like to know if there is any function or method which I can use to parse my database setting file (ie. database.xml). For example, in my web.xml file I indicated
the following:
<servlet>
<servlet-name>database</se
<servlet-class>myproj.serv
<init-param>
<param-name>database</para
<param-value>/WEB-INF/data
</init-param>
<load-on-startup>1</load-o
</servlet>
I was overriding the init method of the InitServlet class which extends HttpServlet class. because of the structure of my web.xml file, I could only get the database file which contains the setting, and this is through getInitParameter("database
Thanks in advance!
Raymond
ASKER
Hi! Thanks for the reply
I would appreciate it if you would post some XML parsing
code, this is because despite the ease of use which you provided in the above code, we were required by our project supervisor to use XML parsing. =)
I would appreciate it if you would post some XML parsing
code, this is because despite the ease of use which you provided in the above code, we were required by our project supervisor to use XML parsing. =)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
before thinking about parsing a XML file (which is easy), why not trying something like :
<init-param>
<param-name>database.drive
<param-value>com.my.driver
</init-param>
<init-param>
<param-name>database.URL</
<param-value>myConnectStri
</init-param>
<init-param>
<param-name>database.user<
<param-value>scott</param-
</init-param>
<init-param>
<param-name>database.passw
<param-value>tiger</param-
</init-param>
Pls tell us if it helps. If you really want some XML parsing sample code, we can provide it as well.
-S