Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Populating new XML into existing DCR
System
Hello,
I have read quite a bit of documentation and have spent quite a bit of time with the experimentation. I'm wondering how to do the following...
Using (preferably) TeamSite::XMLnode or XMLparser, how can I (a) change a value in an existing DCR and (b) insert a new node/value in an existing DCR. Can this be done??
Thanks in advance!
Dave
Find more posts tagged with
Comments
iwovGraduate
a. Heres a simple example:
#----------------------------------------------
use TeamSite::XMLparser;
# pass the full path to DCR as command line argument
my $dcrfile = $ARGV[0];
my $value = get_dcr_attr($dcrfile, "fullname");
print "\n\n value: [$value] \n ";
exit();
sub get_dcr_attr {
my ($dcr,$element_name) =
@_
;
open DCR, $dcr;
local $/ = undef;
my $xml = <DCR>;
my $parser = TeamSite::XMLparser->new();
my $rootnode = $parser->parse($xml);
my $value = $rootnode->value("$element_name");
return $value;
}
#----------------------------------------------
b. I don't have an example handy, but there are a bunch of KBs for manipulating DCRs. See KB 2036 for example. Also see the perldocs for TeamSite::XMLnode, TeamSite::XMLparser, and XML:
OM
Migrateduser
Just a thought. I was pretty sure the preferred way to read/write dcr's was to use TeamSite:
CRparser or TeamSite:
CRnode.
http://support.interwoven.com/library/devel/tst/pt/5_01/TeamSite__DCRparser.html
http://support.interwoven.com/library/devel/tst/pt/5_01/TeamSite__DCRnode.html
Migrateduser
If you look in the comments of DCRparser.pm, you'll find that it is deprecated in favour of XMLparser. In any case, if you diff them, you will see that they are currently almost identical.