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_nameNY_ ONLINE </server_name>
<databaseSchedu lers </database>
<tableSched_Inf o </table>
<user_columnuse rID </user_column>
<delete_columnD eleted </delete_column>
<delete_value 2 </delete_value>
</configFile>
And would the textContent() function be needed? I considered doing the
following:
$server = "server_nam e";
my $parser = XML::LibXML->new();
my $doc = $parser->parse_file($co nfigFile);
my $docRoot = $doc->getDocumentEle ment();
my @configs = $docRoot->getChildrenByT agName($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_nameNY_ ONLINE </server_name>
<databaseSchedu lers </database>
<tableSched_Inf o </table>
<user_columnuse rID </user_column>
<delete_columnD eleted </delete_column>
<delete_value 2 </delete_value>
</configFile>
And would the textContent() function be needed? I considered doing the
following:
$server = "server_nam e";
my $parser = XML::LibXML->new();
my $doc = $parser->parse_file($co nfigFile);
my $docRoot = $doc->getDocumentEle ment();
my @configs = $docRoot->getChildrenByT agName($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
Comment