Hello,
I'm using TeamSite:

CRnode and TeamSite:

CRparser (or TeamSite::XMLnode & TeamSite::XMLparser) to parse DCRs without taking care if it's a dcr in the iwov format or in the xml format.
If works fine but if I modify a file, I must know if it's in the IWOV format or in the XML format or I don't know if I have to call get_dcr() or get_xml().
At the moment, the only "workaround" I found, to to parse the file as a 'document' to get the XML_DECLARATION.
If it's in IWOV format, it will be empty otherwise, I'll get the XML declaration.
my $parser = TeamSite::XMLparser->new();
my $dcr_node = $parser->parse($dcr_string, 'document');
...
my $xml_declaration = $dcr_node->value('XML_DECLARATION');
...
if ($xml_declaration eq '') {
# Interwoven format (iwov in templating.cfg)
$modified_dcr = $dcr_node->get_dcr();
}
else {
# XML format (xml in templating.cfg)
$modified_dcr = $dcr_node->get_xml();
}
This doesn't looks very clean... and I don't want to parse templating.cfg cos it would slow down and make my script more complex...
Anyone already faced this problem ?
Edited by pierreyves on 10/17/05 04:47 AM (server time).