> <results id="Quiz1" file="Quiz1.pdf" n=3>

This isn't well-formed XML.  The n=3 must be n="3".  All attributes in XML
must be quoted, either single-quotes or double-quotes.

Rob

-----Original Message-----
From: David Arnold [mailto:[EMAIL PROTECTED]
Sent: Monday, July 19, 2004 2:04 AM
To: [EMAIL PROTECTED]
Subject: Perl and XML::Simple


All

I tried to run this:

#! /usr/local/bin/perl -w
# File: Responses.pl

use strict;
use warnings;

# Import the SML::Simple module
use XML::Simple;
use Data::Dumper;

# Turn the file into a has reference, using XML::Simples' "XMLin"
# subroutine. We'll also turn on the 'forcearray' option, so that all
# elements contain arrayrefs.
my $resp_xml=XMLin('./Responses.xml',forcearray=>1);

print Dumper $resp_xml;

On this file:

[EMAIL PROTECTED] perlxml]# cat -A Responses.xml
 <results id="Quiz1" file="Quiz1.pdf" n=3><question n=1 type="mc"
ptype="2.1" points=1 credit=0
correct=0><value>a</value></question><question n=2 type="mc" ptype="5.4"
points=1 credit=0 correct=0><value>a</value></question><question n=3
type="mc" ptype="3.6" points=1 credit=0
correct=1><value>a</value></question></results>$
[EMAIL PROTECTED] perlxml]#

And I got this error message:

[EMAIL PROTECTED] perlxml]# ./Responses.pl
Not a quote character [Ln: 1, Col: 38]

Can anyone help?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to