Hello everyone,

I'm new to parsing XML files.  I've got a somewhat working attempt,
but keep getting errors when certain elements are undefined.

Can't call method "as_text" on an undefined value at ./xmltreebuild.pl line 33.

Attached is the XML I'm trying to parse and xmltreebuild.pl.

Any suggestions on how to better do this are greatly appreciated.

Thanks,
Kevin
-- 
Kevin Old
[EMAIL PROTECTED]
<?xml version="1.0" encoding="UTF-8"?>

<products timestamp="08/17/2004 19:00:10">
	<products-updated>
		<product-updated>
			<product-name>Critters (DVD)</product-name>
			<upc>794043637124</upc>
			<street-date>09/07/2004</street-date>
			<msrp>$14.97</msrp>
		</product-updated>
		<product-updated>
			<product-name>Critters 2 (DVD)</product-name>
			<upc>794043637223</upc>
			<street-date>09/07/2004</street-date>
			<msrp>$14.97</msrp>
		</product-updated>
		<product-updated>
			<product-name>Critters 3 (DVD)</product-name>
			<upc>794043637322</upc>
			<street-date>09/07/2004</street-date>
			<msrp>$14.97</msrp>
		</product-updated>
		<product-updated>
			<product-name>Critters 4 (DVD)</product-name>
			<upc>794043637421</upc>
			<street-date>09/07/2004</street-date>
			<msrp>$14.97</msrp>
		</product-updated>
		<product-updated>
			<product-name>Final Destination (DVD)</product-name>
			<upc>794043506123</upc>
			<street-date>09/14/2004</street-date>
			<msrp>$14.96</msrp>
		</product-updated>
		<product-updated>
			<product-name>Final Destination 2 (DVD)</product-name>
			<upc>794043627828</upc>
			<street-date>09/14/2004</street-date>
			<msrp>$19.96</msrp>
		</product-updated>
		<product-updated>
			<product-name>Freddy vs Jason (DVD)</product-name>
			<upc>794043683121</upc>
			<street-date>09/14/2004</street-date>
			<msrp>$19.96</msrp>
		</product-updated>
		<product-updated>
			<product-name>In the Mouth of Madness (DVD)</product-name>
			<upc>794043490729</upc>
			<street-date>09/07/2004</street-date>
			<msrp>$14.97</msrp>
		</product-updated>
		<product-updated>
			<product-name>Jason Goes to Hell (DVD)</product-name>
			<upc>794043562624</upc>
			<street-date>09/14/2004</street-date>
			<msrp>$14.96</msrp>
		</product-updated>
		<product-updated>
			<product-name>Leatherface: Texas Chainsaw Massacre III (DVD)</product-name>
			<upc>794043637728</upc>
			<street-date>09/07/2004</street-date>
			<msrp>$14.97</msrp>
		</product-updated>
		<product-updated>
			<product-name>Nightmare on Elm Street Collection, The (DVD)</product-name>
			<upc>794043478826</upc>
			<street-date>10/05/2004</street-date>
		</product-updated>
		<product-updated>
			<product-name>Texas Chainsaw Massacre, The (DVD)</product-name>
			<upc>794043683428</upc>
			<street-date>09/14/2004</street-date>
			<msrp>$19.96</msrp>
		</product-updated>
		<product-updated>
			<product-name>Texas Chainsaw Massacre, The: Collector's Edition (Dbl DVD)</product-name>
			<upc>794043703126</upc>
			<street-date>09/07/2004</street-date>
			<msrp>$29.95</msrp>
		</product-updated>
	</products-updated>
</products>

Attachment: xmltreebuild.pl
Description: Binary data

-- 
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