L
lnatz
I need to parse a configuration file using xml. How do I retrieve the
data between the elements? For example, if my configuration file was
organized in the following manner:
<configFile>
<server_name> NY_ONLINE </server_name>
<database> Schedulers </database>
<table> Sched_Info </table>
<user_column> userID </user_column>
<delete_column> Deleted </delete_column>
<delete_value> 2 </delete_value>
</configFile>
And would the textContent() function be needed? I considered doing the
following:
$server = "server_name";
my $parser = XML::LibXML->new();
my $doc = $parser->parse_file($configFile);
my $docRoot = $doc->getDocumentElement();
my @configs = $docRoot->getChildrenByTagName($server);
$dbserver= @configs[0] ->textContent();
I don't think it is properly written though and I don't think it would
work, but would that be something close to the proper way of parsing
the configuration file?
Thanks in advance,
Natalie
data between the elements? For example, if my configuration file was
organized in the following manner:
<configFile>
<server_name> NY_ONLINE </server_name>
<database> Schedulers </database>
<table> Sched_Info </table>
<user_column> userID </user_column>
<delete_column> Deleted </delete_column>
<delete_value> 2 </delete_value>
</configFile>
And would the textContent() function be needed? I considered doing the
following:
$server = "server_name";
my $parser = XML::LibXML->new();
my $doc = $parser->parse_file($configFile);
my $docRoot = $doc->getDocumentElement();
my @configs = $docRoot->getChildrenByTagName($server);
$dbserver= @configs[0] ->textContent();
I don't think it is properly written though and I don't think it would
work, but would that be something close to the proper way of parsing
the configuration file?
Thanks in advance,
Natalie