byuhobbes85
08-07-2009, 09:10 PM
I have no idea why this code is not working. I have some XML and I'm trying to get the contents of the root tag. I'm doing a very simple regular expression, but it does no substitution to the $xml string. What is causing this and how do I fix it? Thanks.
use strict;
my $xml = '<prompt xmlns="http://www.imsglobal.org/xsd/imsqti_v2p0" xmlns:awwedu="http://mylab.myuniv.edu/dokuwiki/doku.php?id=awwxmlwitharclitetags" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<awwedu:audio>http://mylab.myuniv.edu/aww/alifbaa_unit6/sounds/ABU06Dr06.01.mp3</awwedu:audio>
</prompt>';
$xml =~ s/<prompt.*>(.*)<\/prompt>/$1/;
print "\n$xml\n";
use strict;
my $xml = '<prompt xmlns="http://www.imsglobal.org/xsd/imsqti_v2p0" xmlns:awwedu="http://mylab.myuniv.edu/dokuwiki/doku.php?id=awwxmlwitharclitetags" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<awwedu:audio>http://mylab.myuniv.edu/aww/alifbaa_unit6/sounds/ABU06Dr06.01.mp3</awwedu:audio>
</prompt>';
$xml =~ s/<prompt.*>(.*)<\/prompt>/$1/;
print "\n$xml\n";