How I want it to be setup is like so:
1.) Print to the browser the xml version, dtd + xsl location
2.) Read in the xml file and store it in an array.
3.) Remove the xml file version, dtd + xsl location in the actual xml file read in from step 2.
4.) Print out to the browser the xml file data ONLY (minusing the xml version/xsl/dtd location that was removed on step 3)
That's it. The reason being is that becuase the xml data files I'm recieving have the dtd/xsl location different than were it's actually going to be - so I need to remove that from the xml data file.
The other problem, is that we have 4 reports type, but right now I'm just testing for just one type. Is the a way to use the regex to start from particular characters and end at a particular characters with a wildcard in the middle? I want to find the string and replace with no value. e.g.:
@lines =~ s/<!DOCTYPE XMLDATA SYSTEM \"artist_royalty.dtd\">//; #????
print "<?xml version=\"1.0\"?>\n";
if ($doctype eq "m") { print "<!DOCTYPE XMLDATA SYSTEM \"http://www.mydotcom.com/DRM/clients/ +XML_FORM/XML_DTD/mechanical_royalty_rightrax.dtd\">\n"; print "<?xml-stylesheet type=\"text/xsl\" href=\"http://www.mydotcom.c +om/DRM/clients/XML_FORM/XSL_templates/M_template_rightrax.xsl\"?>\n"; } elsif ($doctype eq "a") { print "<!DOCTYPE XMLDATA SYSTEM \"http://www.mydotcom.com/DRM/clients/ +XML_FORM/XML_DTD/artist_royalty_rightrax.dtd\">\n"; print "<?xml-stylesheet type=\"text/xsl\" href=\"http://www.mydotcom.c +om/DRM/clients/XML_FORM/XSL_templates/A_template_rightrax.xsl\"?>\n"; else { print "<!DOCTYPE XMLDATA SYSTEM \"http://www.mydotcom.com/DRM/clients/ +XML_FORM/XML_DTD/license_royalty_rightrax.dtd\">\n"; print "<?xml-stylesheet type=\"text/xsl\" href=\"http://www.mydotcom.c +om/DRM/clients/XML_FORM/XSL_templates/L_template_rightrax.xsl\"?>\n"; # The snippet below opens then reads the XML data file from the server +<br> # and prints it to the browser - so that they can view it - and not kn +ow<br> # where the doc originates from. open (XMLFILE, "/opt/www/docs/$document") || &open_error("http://$serv +er$document"); @lines = <XMLFILE>; close (XMLFILE); @lines =~ s/<?xml version=\"1.0\"?>//; #???????????? @lines =~ s/<?xml-stylesheet type=\"text/xsl\" href=\"A_template.xsl\" +?>//; #???????????? @lines =~ s/<!DOCTYPE XMLDATA SYSTEM \"artist_royalty.dtd\">; #??????? +????? foreach $line (@lines) { #chop $line; print "$line"; }
In reply to Regex on a array by adobepro
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |