CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate: Re: [1arryb] How can i use xml-moduls for my problem?: Edit Log



0815
Novice

Jun 3, 2009, 11:42 AM


Views: 3440
Re: [1arryb] How can i use xml-moduls for my problem?

 

product id:


Code
<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!DOCTYPE tables SYSTEM "keydb.dtd" >
<!-- -->
<tables>
<tableset srcid="generated">
<table name="SAPINST_EXE" namespaces="STANDARD">
<columns>
<column name="COMPONENT">
<defaultproperties>
<property name ="ANCESTORS_DISPLAY_NAME" value ="SAP SCM 5.0 Support Release 3 &gt; SAP Systems &gt; Oracle &gt; Distributed System &gt; Based on AS ABAP &gt; " />
<property name ="DISPLAY_NAME" value ="Global Host Preparation" />
<property name ="INSTALLATION_START" value ="20080814125437" />
<property name ="INSTALLATION_STOP" value ="20080814125553" />
<property name ="PPMS_COMPONENT_NAME" value ="ind" />
<property name ="PPMS_COMPONENT_RELEASE" value ="ind" />
<property name ="PRODUCT_ID_FROM_CATALOG_FILE" value ="d0e23657" />
</defaultproperties>


I parse with regex the file it is the better solution. Because
my string are in the first few lines.




Code
# search product id in keydb.xml and instert as comment in inifile.xml 

sub product_id {
my $keydb = $_[0];
my $product_id = "";

open( FILE, '<', $keydb ) || die "Fehler beim Oeffnen zum Lesen: $!";
while (<FILE>) {
chomp;
if ( $_ =~ /PRODUCT_ID_FROM_CATALOG_FILE/ ) {
$_ =~ s/.*value ="//g;
$_ =~ s/" \/>//g;
$product_id = $_;
print "produkt id :" . $product_id . "\n";
print "inifile_out :" . $inifile_out . "\n";
last;
}
}
close FILE;

open( INIFILE, ">>$inifile_out" ) || die "Can not write $inifile_out";
print INIFILE "<!-- #" . $product_id . "# -->";
close INIFILE;
return $product_id;

}



(This post was edited by 0815 on Jun 22, 2009, 11:55 AM)


Edit Log:
Post edited by 0815 (Novice) on Jun 3, 2009, 11:43 AM
Post edited by 0815 (Novice) on Jun 3, 2009, 11:57 AM
Post edited by 0815 (Novice) on Jun 22, 2009, 11:55 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives